is there any way to send a dynamic order by to a query in a report?
suppose that you have made a report with Q1 query . but you want to have 3 types of ordering refferd to 3 other columns.
how can we do this?
Use lexical refecence in the order by clause.
the lexical reference must refere to a variable that can be change in the before report trigger of the report.
You must initialise the variable with a liste of columns corresponding to the first clause of the order by, for exemple.
User variable x
x initialised with a, b, c in the initial value field.
In the query,
order by &x
In tne prameter form:
prompt the user with the choise of the order. 1, 2 or 3
In the before report trigger
Verify the choise made.
Depending on the response
change the value of the variable x.
if response = 1
x := 'a, b, c'
else if reponse = 2
x := 'b, c, a'