ken bohnenkamp
8th November 2002, 21:47
I have added a query extension to extend my where clause so that I only get a subset of records when zooming to another session. After the records are selected, I would like to order them by a date in descending order. Does anyone know how I can do this?

mark_h
8th November 2002, 23:06
Yes you can add indexes to tables. Just go into Maintain table definitions(ttadv4120m000), click on indices and add the one you want. Next do a convert to runtime and then log off and back on.

From your other posts - it looks like you then need to go maintain the session in question click on change key and add the new index. Note that you may want to make this new index have a sort = 1 (start index). Just remember that whenever you start this session this will be the default index.

Good Luck!

Mark

kbabu1
6th November 2009, 13:24
Can we sort records in descending order when session is started?

ks_ks_
6th November 2009, 15:19
yes we can.. use query.extend.where put the condition and ._index1 desc.. it works well

rberti
6th November 2009, 15:41
is there a way to do it in baan4?

bdittmar
6th November 2009, 16:10
is there a way to do it in baan4?

Hello,

BaanERP Programmers Guide


query.extend.where(), query.extend.where.in.zoom()

--------------------------------------------------------------------------------

Syntax
void query.extend.where( string extension_string [, mode] )
void query.extend.where.in.zoom( string extension_string )

Description
Use this to construct a query extension for the WHERE clause of a database query. Use query.extend.where() for non-zoom sessions. Use query.extend.where.in.zoom() for defining query filters for zoom sessions.

Arguments
extension_string
A string containing the names of the fields to be included in the WHERE statement. Use commas [,] to separate the field names.

mode
This optional argument can have one of the following values:

EXTEND_OVERWRITE replaces any existing query extension
(this is the default mode)

EXTEND_APPEND appends this extension to the existing extension


Note
In BaanERP, this function replaces the predefined variable query.extension that was used in earlier versions of the software.

Context
You can use query.extend.where() in the before.program section of UI scripts and in the before.open.object() hook of DAL scripts. You can use query.extend.where.in.zoom() only in the selection.filter section of UI scripts.

Regards

rberti
6th November 2009, 17:25
Hi bdittmar.
I use these functions a lot in LN, but in baan4 it don't work.
So I use the pred. variable query.extension to filter the main table query, but not to change the table's order or to sort in descending order.

So, the question: Is there a way to do it in baan4?

kbabu1
15th November 2009, 15:35
All,

Thanks for replying to my query.

I tried this in Baan 5c and it didn't work. We cannot specify 'order by' clause in query extensions.

If anyone tried this and if it worked then please let me know.

Thanks,
Regards

NPRao
18th November 2009, 22:25
I tried this in Baan 5c and it didn't work. We cannot specify 'order by' clause in query extensions.
Try,

void query.extend.order( const string extension(), [ long mode ] )
Try with mode - 0, 1

kbabu1
28th November 2009, 11:36
tried both mode 0 and 1...it did not work.:(

rahul.kolhe22
30th November 2009, 08:59
Hi,
Please try the following option. This works for me well on LN.
query.extend.order (<field name> [Sort Direction])
eg.
query.extend.order ("tccom100.abcd DESC")
here tccom100.abcd is just some field on which I have to do order by in descending order.

Regards
--Rahul

kbabu1
3rd December 2009, 15:34
I need some solution in Baan 5c...

Mario
17th December 2009, 15:05
Dear Rahul,
query.extend.order(...) is not listed in any program manual - or I can't find it - is this a hidden feature or they just forgot to 'share' this one. I only see query.extend.select/where/from.
Where did you find this option?

Best Regards, Mario

rahul.kolhe22
18th December 2009, 07:05
Hi Mario,
Even I could not find "query.extend.order" function in programers guide for LN.
I came to know about it from the following link:
http://www.baanboard.com/baanboard/showthread.php?p=149371#poststop

Regards,
--Rahul

catnesma
10th March 2010, 07:56
before.program:
query.extension = "tssoc200.osta = tssoc.osta.free" works fine but what if I have other conditions before I dispay my form
like ( tssoc200.osta = tssoc.osta.planned) and (tssoc200.csco <> " ") and others.

catnesma
10th March 2010, 08:44
I want to display only service orders with the following condition

tssoc200.lftm - utc.num() <> 0 and tssoc200.csco <> " " (DAL script)

hemantubhe
8th November 2011, 08:30
hi Rahul,
Can u suggest other method to do sorting, In BaaN Iv i m facing similar Problem and above solution is not working

rahul.kolhe22
8th November 2011, 12:39
Hi Hemant,

You can try creating the new index for the fields according to which you need sorting.

Note: May be you would require the Duplicate flag ON for this new created index (depends on you requirement).
Also I would suggest you to create new index only if it is your customized new table.

Then in section init.form you can call the function to.key() to change the index to the new created one.

I dont know if doing so is a good idea.

I would like if some Gurus/Experts on the board would share some ideas about it and let us know about the most preferable approach.

Hope it helps you.

Regards,
--Rahul