Page 1 of 1

Selecting sort field at runtime

Posted: Thu Sep 03, 2009 7:04 pm
by moonraker12
Is there any way to select the field to sort by at runtime? I tried a RRparameter and referenced it in the sort screen but it totally ignores what I enter at runtime and does not sort. Additionally, is there any way to select ascending or desending at runtime as well? I^me using version 12.x

=> RE: Selecting sort field at runtime

Posted: Tue Sep 08, 2009 10:09 am
by kfleming
You can use RI_SORT fields in your control table to set sort order. The RI_SORT fields let you choose the sort order as well as the sort field.____My guess is that you are using the parameter field directly for your sort (which returns a literal value) and that is way it appears to ignore your entry. Typically you would create a calculated field that evaluates the parameter entry and returns a field based on the parameter entry.__For example you could have the user select either FIRST or LAST as the parameter value.__Then you would sort using a calculated field with the expression:__IIF(PARAM="FIRST",FNAME,LNAME)______Kathleen__R&R Support

=> RE: Selecting sort field at runtime

Posted: Mon Sep 21, 2009 1:08 pm
by Thomas_Freitas_(Guest)
I use a database connection where I link using the record number function. When the user runs the report, I create a unique databases for the user and in the control database, RRWRUNIN.DBF, in my case, I use the alias for the report to use that unique database. In the database is a field I have called SORT. I put a number in there so that I can use it on any database. I then have a variable in my R&R that looks something like this.____Case(number=1,"car_number",2,"Car_initial",3,"default_sort")____I also have a header case selection so that the sort is named in the report for the user.______Tom Freitas

==> RE: Selecting sort field at runtime

Posted: Tue Sep 22, 2009 3:42 pm
by kfleming
Your case statement is returning literal text rather than an actual field name. That is why it is not working.__You need to have 3 different character fields in your case statement.__For example:__Case(number=1,car_number,2,Car_initial,3,default_sort) ____will work as long as you have 3 fields named __car_number__Car_initial__default_sort____that all have the same datatype.____Kathleen__R&R Support____