gerardd
9th November 2012, 08:46
I need to report on the items in tiitm001
per item I need to check on an item with a name direved from the current item.
How do I do that?
I lose the current item in the first select.
select tiitm001.* from tiitm001
where tiitm001._index2 inrange {:kitm.f, :item.f}
and {:kitm.t, :item.t}
selectdo
hlp_item = tiitm001.item
hlp_item(9;1) = "V"
select tiitm001.* from tiitm001
where tiitm001._index1 = {:hlp_item}
selectdo
if voorwaardenOK() then
printArtikel()
endif
endselect
endselect

RedBatz
9th November 2012, 11:58
Hi,

you can use an alias in your second query, selecting only required fields.

Regards,

Red.

gerardd
10th November 2012, 09:30
Hi,

you can use an alias in your second query, selecting only required fields.

Regards,

Red.
Thanks for your suggestion
but I need to check tiitm001.stoc and some more fields in both selects.

BaanInOhio
11th November 2012, 04:54
You have to assign field values into local variables when using alias buffers for selects in the same table. In the example below, your main table (outer read) variables will be in tiitm001 table fields. The inner select (specific item) will use local variables for the fields that you need:



domain tcdsca tmp.dsca
domain tcqiv1 tmp.stoc
domain tcitem hlp_item


select tiitm001.*
from tiitm001
where tiitm001._index2 inrange {:kitm.f, :item.f} and {:kitm.t, :item.t}
selectdo
hlp_item = tiitm001.item
hlp_item(9;1) = "V"
select altitm001.stoc:tmp.stoc, altitm001.dsca:tmp.dsca.
altitm001.... <add more fields as needed>
from tiitm001 altitm001
where altitm001._index1 = {:hlp_item}
selectdo
if voorwaardenOK() then
printArtikel()
endif
endselect
endselect

gerardd
13th November 2012, 08:21
Thanks BaanInIhio,
I'll use that