Ording and filtering Report by Variable

kolaboykolaboy Member Posts: 446
Hi,
I have develop a report that is counting payments by looking at document Payment and subtract it from the months queried using start period and end period to get the months owed. The months owed is a global variable of type decimal. I want my report to be able to filter by months owed. say filter by all customers who owed 2months- 3months or 4months and so on.

How can i do this? Can someone help me please.
Thanks

Comments

  • kinekine Member Posts: 12,562
    Use temp table for that. Fill it with the data, filter it, loop it, do what you want.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • apertierraapertierra Member Posts: 61
    variable
    monthsfilter text 250;
    auxmonths record integer;
    OnAfterGetRecord

    monthsOwned := CalculateTheMonthsOwnedFunction("Customer");
    IF (monthsfilter <> '') THEN
    BEGIN
    AuxMonths.SETFILTER(Number,MonthsFilter);
    AuxMonths.Number = ROUND(monthsOwned,'>',1);
    IF (NOT AuxMonths.FIND) THEN
    CurrReport.SKIP;
    END;
  • kolaboykolaboy Member Posts: 446
    variable
    monthsfilter text 250;
    auxmonths record integer;
    OnAfterGetRecord

    monthsOwned := CalculateTheMonthsOwnedFunction("Customer");
    IF (monthsfilter <> '') THEN
    BEGIN
    AuxMonths.SETFILTER(Number,MonthsFilter);
    AuxMonths.Number = ROUND(monthsOwned,'>',1);
    IF (NOT AuxMonths.FIND) THEN
    CurrReport.SKIP;
    END;
    Where should the above code be place. In the temp table or in the cust.ledger Entry table where i am doing the calculation.

    Kine, Can you please explain to me in steps form like apertierra does how to use the temp table.
    Thanks
  • apertierraapertierra Member Posts: 61
    You don't need any temporary table, since you are not sorting, if you were needing to sort, check the "top customers list" report or the "top items list" report to see how to do so.
    If you really need to ask where the code I put needs to go, you migth better ask your NSC to create the report for you.
  • kolaboykolaboy Member Posts: 446
    I would also like to sort by months owed.
    Thanks
Sign In or Register to comment.