mostrightfuture
8th October 2004, 11:03
Hi all friends

I have generated report for sales order lines. On report printing and parameter selection session, I provided different option for sorting. Whatever option user select for sorting (Planned delivery date, Planned Rec. date or any other) records are not sorted accordingly, sorting of records not changed on selection of different sorting option. I think I am missing something.

Thanks in advance
Mahmood

SriksAdi
8th October 2004, 15:02
Hi,
Could you please paste you code.


regards
Sriks

mark_h
8th October 2004, 16:10
Not sure I understand what your are doing. On the form for the user you have placed some option so the user can select how the report is sorted - is this correct? If so then how do you send the record to the report - are you making sure you script does the sorting? Also in the case make sure there are no sorts on the report.

I have seen 3 ways to handle something like you mentioned - in all 3 cases there are check boxes on the forms for the user to select the sort option.
(1) First method is with different reports for each sort criteria. Then when the user checks a box for a sort then the session code changes the report group and calls the report with the correct sort criteria. In this case the same report is cloned and the sort options change.
(2) A string sort key is used in the script and passed to the report. In this case as the user checks box or boxes the sort key is built in the correct field order by the session script. Then this key is passed to the report for sorting.
(3) In this method the sorting takes place in the code of the session. Then the records are passed in the pre-sorted order to the report. The report does not have any sorts on it.

I am a lazy coder and use method 1. A quick check box for a sort, clone the primary report, change the sort, then add code to check the check box and change report group.

Mark

mostrightfuture
8th October 2004, 17:05
HI friends,

Thanks Mark for the detail reply. The situation is at my side is as follows:

There is a drop down list (combo box) contains the list of possibilities on which the report could be sorted (each value is corresponds to one index of the table). In the report script, I checked which option is selected by the user from the combo box and implemented a case structure on selected value in combo box. In the case structure I made the query to get the record for report, used order by clause to sort the records on the index of the table on basis of user selection. But report alwasy shows the same result. Dont know where is the problem.

Thanks again
Mahmood

NPRao
8th October 2004, 20:33
Check on the Report Input fields for that report - ttadv3532m000 and the fields specified for sort

mark_h
8th October 2004, 20:51
Lets see if I understand correctly - you are trying to sort the records in the report script itself? If you are passing all of the records to the report then you need to do your sort in the program script - then just use rprt_send to send the records to the report in a presorted order. I usually do the report method I mentioned. Then the same session script is used for all of the reports.

Mark

tools123
8th October 2004, 21:02
Looks like you need to be clear on a couple of things here.

1. is this a session developed by you / at your site?
if so look up the program script if you have access to it.
As Mark put it (and is usually the case), the script for sorting is already there at the program script.You do not need to do anything other than set
all the input sort fields in the report to presorted.

2. As NPR also directed you, your changes are reqd. only in the report input fields. No need to put the case statement in report script.

3.if you are still stuck, start from simple no changes report and add changes
and monitor output

SriksAdi
9th October 2004, 08:12
Hi,
The sorting order of input fields defined in the report overwrites the sorting order defined in the program script.

In your case, the input fields should have the sorting mode as Presorted.


regards
Sriks