Print data in a report with a different order that we define on keuy definiton

In my Invoice report, data are order on DataItemTableView by (Product Group Code,Line No.). but in the print report I would like to change the sorting definition.

My question is, I must cal data by a sort definition, but I need to show to user in print report a different order.

Can I do That? How?

Thanks

You can try something like

IF NOT CurrReport.PREVIEW THEN
.SETCURRENTKEY();

Where do <I have to put this condition?

Thanks

Data Item OnPreSection…

Did not result :frowning: with this option

I put it OnPreSection

IF NOT CurrReport.PREVIEW THEN
“Purch. Inv. Line”.SETCURRENTKEY(“No.”,Type,“Line No.”);

Any idear about how to to this?

If you want the user to specify the sort order leave the DataItemTableView blank. You’ll get a sort button in the lower right corner of the request form.

Matt I can’t do that. My invoice report prints variable data group by Product Group Code. So, DataItemTableView can not be change.

After get variables values, can I say to the report to print data order by Line nº, this must be before preview, I tryed this

OnPreSection

IF NOT CurrReport.PREVIEW THEN
“Purch. Inv. Line”.SETCURRENTKEY(“No.”,Type,“Line No.”);

but no results :frowning:

I don;'t understand what you mean by the sorting of a report has anything to do with the data you’re getting?

Doesn’t the report get allt he data based on whatever tables & filters you use and the report is just a tool to display that?

So personally I’m not following the “I need to GET data using a certain key” and “I need to SHOW data using a diferent key”.

Can you explain more?

My Invoice lines has 9 (aa1a2,bb1b2,cc1c2) different lines, that are converted on 3 different variables A, B and C. I keep total values that I can get grouping that 9 lines by Product Group Code.

The Invoice Report prints 3 Lines with that Variables, like :

A

B

C

My question Is, this variables I would like to print like

C

B

A

I can not chanhe DataItemTableView from SORTING(Product Group Code), because this is the Key thar gives me the variables correct result.

Do You understand???

Then insert your results into a temporary table and show them in the order you want to.

I have never done this before. I am not sure how to do it.

Can you give one exemple from any navision standard objects?

Thanks

You want Keep the sort But change the order then edit your DataItemTableView from
SORTING(Product Group Code)
to
SORTING(Product Group Code) ORDER(Decending) or (Ascending) depending on what you want.

http://www.mibuso.com/howtoinfo.asp?FileID=6