DBAsupport.com Forums - Powered by vBulletin
Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2000
    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?


  2. #2
    Join Date
    Jun 2000
    French Polynesia
    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,
    select ...
    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'
    else ...

    This will do the work

    bye rbouissou

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width