jruben021
27th February 2004, 16:33
Hi, everybody:

Does anybody know how can I manipulate Tools/Query from 4GL script program??

I need change order from main table in consult session, simply.

But, I have only one index _index1 on mydate & myhour fields (1st and 2nd fields of my own table tdilc999). I just want order this table on mydate & myhour in descending order.

This is a log table, where I post all warning and error events from an application. I need to show in first place the last event occurred.

Thanks for your attention..... and yours replies. :)

en@frrom
27th February 2004, 16:43
Hi,

Use 'desc' in the order by clause, for exapmle:
select *
from tdilc999
where tdilc999._index1 inrange {:date.f, :hour.f} and {:date.t, :hour.t}
order by tdilc999._index1 desc

Good luck!

En

jruben021
27th February 2004, 17:06
Hi en@frrom

Thanks for your fast reply!!!

I understand that you mean..... but, in which 4GL script section can I put this code?? before.program ??? init.form???

Rember, this session is type Consult with Main Table

My sesssion contain 3 forms, one by one show different fields from log table tdilc999

Thanks again!!

en@frrom
27th February 2004, 17:13
Oops, sorry, didn't realise you were referring to a display session. I thought it was regarding a regular select query...

I see that you are on Baan IV, correct? In Baan 5, which I work with, you do this with a query.extend.order("tdilc999._index1 desc") in the before.program section. In Baan IV it is still query.extension instead of query.extend and I am not sure if you can use an extension for order by clause as well.

Baan IV pals?? What do you say??

JaapJD
27th February 2004, 17:46
Create two extra fields (complement date and time) and an extra index in your table. Fill date with 999999 - date and time with 999999 - time.

jruben021
2nd March 2004, 00:02
Hi JaapJD :

Excellent, excellent tip.... thanks!

JRuben :)