shambhavi
20th July 2023, 14:12
I have to filter some data from session where session switch to finance company and check if data is present or not then again switch back to logistic company.

I need to do it in query.extend.where()

tfacr200._compnr in (" &
" select a_ciext215.sfcp " &
" from ciext215 a_ciext215 " &
" where a_ciext215._index3 = {xiext802.orno.rq, xiext802.seq.tkt, xiext802.seq.tdr})

this is not working as per our requirement.

tfacr200._compnr = (" &
" select a_ciext215.sfcp " &
" from ciext215 a_ciext215 " &
" where a_ciext215._index3 = {xiext802.orno.rq, xiext802.seq.tkt, xiext802.seq.tdr})

for above piece of compilation was successful but getting SQLState 42I89 error

it will be great help of any one suggest ow to do it.

Thank you in advance

mark_h
20th July 2023, 14:42
I am no expert on query.extend, but search the form for query extend where. This is one example http://www.baanboard.com/baanboard/showthread.php?t=74655&highlight=query+extend. I think the search fields on a_ciext215._index need to be values when you build the query.extend string. So search and see if you can find a good example.

OmeLuuk
20th July 2023, 15:24
...for above piece of compilation was successful but getting SQLState 42I89 erroris addressed in your programmers manual: as "42I89 - Invalid company number expression
The company number expression is not valid." with two examples.
But there lacks an indication to how to resolve it...
There seems to be several texts for error 42I89. What is the complete message you get?

In the a_ciext215._index3 = {xiext802.orno.rq, xiext802.seq.tkt, xiext802.seq.tdr}) part, what do you expect to be used as index3 fields?
xi or ci?
when these are variables filled at runtime, you would probably use something like this instead: a_ciext215._index3 = {:xiext802.orno.rq, :xiext802.seq.tkt, :xiext802.seq.tdr})ora_ciext215._index3 = {" & quoted.string(xiext802.orno.rq) & ", " & quoted.string(xiext802.seq.tkt) & ", " & quoted.string(xiext802.seq.tdr) &"})"

shambhavi
25th July 2023, 10:43
thank you both, will try with ome solution..if it works will update it here.

shambhavi
31st July 2023, 09:06
I tried with Omeluke suggestion but while passing values of same table i.e xiext802 in where clause of ciext215 will give null values at before.program.

so result will not come as excepted.. any suggestion about how can we bring switch company logic in query.extend.where.

thank you in advance

OmeLuuk
7th August 2023, 11:14
In the before program, the variables may not have been initialized yet. You can set the query extenstion later in the script, but you have to call the rebuild.query (and execute find.data
to be sure the current record is also within selection).

- edit - You may want to import the variables used before using them actually. Be sure the variables are also declared (like in your case I assume "table txiext802" should do that)

FrenkR
22nd August 2023, 13:18
you can use _compnr field, e.g " and _compnr = 200 " for company 200.