Kingsto88
24th March 2006, 10:58
Dear experts,

I think this is a difficult question and i will try to explain it the best i can.

I am using LN now and would like to sort the Service order screen (tssoc2100m000) by another field, First Reference.

Since first reference is not in the table tssoc200 index key, can i still sort by First reference? Putting the field into the session is no problem but can i sort the display records by First reference, without the source code of tssoc2100m000?


As a workaround, I am thinking of creating a new session.
In the new session, how do i make it sort by First reference without adding a new index key into the table tssoc200? Can I use the find button to search for specific First reference if I dont add the field as one of the index key?

Thanks and regards,

en@frrom
24th March 2006, 12:43
- I have not yet used LN, but in Baan IV/V you can use the filter option (ttstpqbf) and set the sequense of the sortfields (second form). Of course this would require manual action of the user each time.
- You could write and AFS-session and just add a query.extend.order on the required non-index field.
- I have never tried it, and I know that some Tools-objects/sessions are problematic via AFS, but you could of course try to activate the QBF (filter) from within your AFS session, by using AFS (like this all action will be done without user noticing a thing. This would be nice, yet as I said, I cannot guarentee that it will work... If you would opt for this option, I could help you with the form-field-names of the qbf...
- The def.find choice (spyglass) is for index-fields only. You could of course activate INSTEAD of the Baan standard pop-up, a subsession with a dialog containing selection fields, in which the user enters the search values, they are then played back to the main session, and the query is performed. I have done this in the past, so if you would wish, I can send you a sample program.

So yes, in standard Baan the options are limited, but with a bit of fantasy and time, you can meet all your requirements...

Good luck!!
En

mark_h
24th March 2006, 15:59
I think in the second session you would do the reverse of the original session and the main table would be the one with the new reference. I am not sure how hard it would be to duplicate the rest of what tssoc2100m000 does. And if you have source code you may want to look into the query.extend.order that En mentioned.

NPRao
24th March 2006, 19:45
Since first reference is not in the table tssoc200 index key, can i still sort by First reference? Putting the field into the session is no problem but can i sort the display records by First reference, without the source code of tssoc2100m000?
Kingsto,

You can create a filter on a table-field and it does not have to be part of Index. But be aware any fields which are not part of indexes and are used in filters are performance overhead to the database. After you fill the field value, you can specify the sort order (ascending or descending). Refer to the screenshot. There is no need to change the source code.

Kingsto88
27th March 2006, 04:58
Dear all,

Your ideas are all excellent. Did not think of it this way.
But can anyone give me the script and idea on how to write the program.

My thoughts are
1) create a session for user to key in the search string
2) click continue and it will open a new session with main table tssoc200 where First reference is.

Eg. If user enters DISHWASHER, I want the new session to display all records which has .*DISHWASHER.*

Please help me with the script. How do i use query.extend.order and filtering to do this?

Thanks and regards,

en@frrom
27th March 2006, 12:05
You create a main session type display, which is basically a copy of the standard session tssoc2500m000 (or whatever session this is based on). In the start option you may enter def.find, in case you decide that user always has to enter selection first. In the program script you write a little peace of code like this:


sess.id = start.session(MODAL, "tssoc2900s000", "", "")
import("refa", refa)
import("...", ..other fields..)
to.form(form.curr) or display("field names")
choice.again() |to avoid the standard def.find from popping up..


In before.form section you write your query.extend.where(" tssoc220.refa LIKE... etc.
then rebuild.query()
if necessary add execute(find.data) or so

You create a subsession tssoc2900s000 with form type dialog (via session generator), one (or more if required) field(s), let's say named ref1. Default button shall be cont.process and on choice.cont.process and choice.end.program and choice.abort.program, you export the variables again.

Of course this is a very raw example, but it is just to give you the clues...

NPRao
27th March 2006, 20:40
My thoughts are
1) create a session for user to key in the search string
2) click continue and it will open a new session with main table tssoc200 where First reference is.

Eg. If user enters DISHWASHER, I want the new session to display all records which has .*DISHWASHER.*
Kingsto,

Please check your requirements again. I don't think its a good design to create a new session for every other session to handle a search criteria. You have the "find" option to look up records if the field is part of the primary key, else you can use the filters (assuming you are on LN version, refer to my screenshot). There is no need to reinvent the wheel to create new sessions/script code. Our end-users are trained to use filters and in an optimum way so that the database does not get a performance hit and we try to proactively monitor the performance and get those frequently used fields into indexes.

Kingsto88
29th March 2006, 03:50
Thank you all who has replied.

Again your ideas are very good. Will try them now and see which is the best.

Thanks again! I really appreciate your help and suggestions! Go Baan!