BaanTech
1st November 2002, 17:10
Hi,

We are trying to limit records shown in a new select session to
the parameters defined by the user in the front end and based
on specific values in the main table (tdpur941) and related tables
(tdpur940). tdpur941 (lines) references tdpur940 (header) at the order number.

I can handle one filter through the use query extension to add an additional filter to show lines only where tdpur941.soli = 0. (Sales Order Line = 0)

What I now need to do is add additional 'show' filters based on the customer range (where the value is stored in tdpur940) and the delivery date range (where the value is stored in tdpur941).

(Values come from front end entries)

How do I select additional tables via query.extension and how do I filter via ranges.

If I can't do this where do you suggest I put my new select ? (Can I do something like main.table.io, before.read).

What I need is:

select 940, 941
where 941.soli = 0
and 940 supplier equals supplier determined in previous form
and 940 customer inrange entered in previous form
and 941 delivery date inrange entered in previous form

Note: All previous form values are imported where needed.

I know about query.extend, but we are on IVc3 and this approach
does not seem to be an available option.

Thanks.

BaanTech

lbencic
1st November 2002, 18:41
In Baan IV, the query.extend is limited to only extend the 'where' clause of the main query. In Baan V, you can also extend the select and from clauses, and so could do what you need there.

For Baan IV, if the query.extend does not do all you need, use the after read section to further limit:


main.table.io:
after.read:
select tihra940
from tihra940
where tihra940._index1 = {:tihra941.orno}
selectdo
if tihra940.suno <> prev.form.suno then
skip.io("")
endif
if tihra940.cuno <> prev.form.cuno then
skip.io("")
endif
endselect



Not the full code for what you need, but you get the idea. Use skip.io("") to not display the records. As you can see, it adds overhead for each read.

Good luck

BaanTech
1st November 2002, 19:44
Great ! Works using:

query.extension = "tdpur941.ddat inrange :ddat.f and :ddat.t and " & "tdpur941.soli = 0"

and


main.table.io:
after.read:
select tdpur940.*
from tdpur940
where tdpur940._index1 = {:tdpur941.dono}
selectdo
if tdpur940.suno <> suno then
skip.io("")
endif
if tdpur940.cuno < cuno.f or tdpur940.cuno > cuno.t then
skip.io("")
endif
endselect

Is there anyway to modify the sorting of fields on a multi-occ (2)
form. Main table is tdpur941, but I would like to display records
using tdpur940.cuno, tdpur941.ddat and tdpur941.dono, and line.

If I need to reselect then I'd probably want to leave it as is (sorted by tdpur941.dono (order)) for the sake of performance.

Thanks.

BaanTech

evesely
1st November 2002, 21:23
You select a table index for sorting in a session. If the customer field isn't on your 941 table, you won't be able to sort using it.

BaanTech
1st November 2002, 21:32
Yah, that's what I thought ... Thanks.

What I'll do is build an option for my users to mark specific records based on customer.

If they still need to sort by customer I'll add this field directly
to tdpur941 as display always.

All depends on what the users want. Thanks.

BaanTech