Sorting a report using Variable in a codeunit

asemberengasembereng Member Posts: 220
How can i possible sort a report using a variable in my codeunit. The report is suppose to display arrears and also the number of months not paid.. I want the report to be sorted by number of months not pay.
Thank you..

Comments

  • BeliasBelias Member Posts: 2,998
    create a new table with 2 fieds: "number of months not pay","document no."
    PK of the table: "number of months not pay","document no."

    declare this table as temporary in your report, and when you calculate the no. of months, fill the table with this number and the document no.

    after that, use the table to get the document nos ordered by "number of months not pay" and show your info in an integer dataitem

    hope it's clear :mrgreen:
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • asemberengasembereng Member Posts: 220
    Pretty confusing.. Explain further..
    Thanks[/quote][/code]
  • BeliasBelias Member Posts: 2,998
    asembereng wrote:
    Pretty confusing.. Explain further..
    Thanks
    [/code][/quote]
    yes, you're right...i am pretty occupied...
    create a new table with 2 fieds: "number of months not pay","document no."
    PK of the table: "number of months not pay","document no."

    i think this one is clear...

    declare this table as temporary in your report, and when you calculate the no. of months, fill the table with this number and the document no.

    in your rpt, declare a rec variable (temporary = yes) that point to the new table you have just created.
    fill this table: field "number of months not pay" becomes the number of months you want to use to order the report.
    "document no." becomes the actual document number you're processing.

    after filling the table, you have to add a new dataitem(Integer table) and use it to loop into the temporary table: you read the first record e.g.:
    field1=1 field2=INV08001

    you do a GET on the table you need in your report (e.g. posted sales invoice) using the 'INV08001' and then show all the data you want.
    for more info about showing a temporary table in a report, try to search the forum!
    :D
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • apertierraapertierra Member Posts: 61
    Check the top customers list or top items list reports for an example on how to do that.
Sign In or Register to comment.