srinivas
25th February 2002, 12:08
Hi,

Any one tried "order by" in query.extension?

I tried this code in a display session.

before.program:
query.extension="tdinv700.trdt>0 order by tdinv700.trdt desc"


I am getting message "Syntax error in expression" when I run the display session.

Any clues....???

Thanks & Regards,
Srinivas

Smiffy
25th February 2002, 15:03
I was advised to use query extension in the way that you have mentioned. I asked if there was a simple way to order the records of a display session, without having the order set up as an index.

I checked the baan help on this matter, and I dont believe that query.extension allows you to do this. It seems that all you can define with this, is extra selection citeria using 'AND' as a separator.

I wished to show records sorted by a numerical field (or date) in reverse order, i.e. latest record first. My solution is to create a new field on the table, which is a negative version of the field concerned. e.g.

0 - field value
This new field can be set up as part of a new index as required.
This new index can then be set up as a sort order for the session.

Obviously, wherever the original field concerned is created or updated, the new field requires calculating and storing on the table. This solution is fine for my needs, as the software concerned is bespoke (new development), and so is the table. It is risky to make changes to baan standard tables and is best avoided, this is why I wished to know i there was another way (for future reference).

srinivas
26th February 2002, 11:48
Thanks Smiffy for that update. I was trying this after seeing one of your earlier posts on having the data in descending order on date field. I was trying to simulate whether Order by clause works in query.extension (as others were suggesting).

NeilPengelly
11th September 2003, 21:30
You can use the following (BaanV only):

before.program:
query.extend.order("<fieldname> desc")

Looks like a hit on performance though.

-- Neil

en@frrom
16th September 2003, 17:46
Thanks Neil!! Helped me out!! query.extend.order() is not mentioned in the Baan manuals! Any other "hidden" options??

En.

en@frrom
16th September 2003, 18:14
If a "group by" would be possible with query extension, it would be of great use to me.

Anyone??