assassinator
28th October 2011, 11:48
I narrate the condition.
I make a display session. Just display item, Lot, order(include purchase order and production order), Lot Qty on Hand. The user require the record which 'Lot Qty on Hand' is zero would not display in form.

'Lot Qty on Hand', tdltc001.stoc was defined double type. So I wrote like this:
before.program:
query.extension = "tdltc001.stoc > 0.00001"
But it doesn't work. I thought the fault would be the decimal digits. And then I wrote this script:

field.tiitm001.cuni:
before.display:
select tdltc001.clot, tdltc001.olot, tdltc001.orno, tdltc001.item,
tdltc001.cprj, tdltc001.cntr, tdltc001.ardt, tdltc001.quam, tdltc001.stoc
from tdltc001
where tdltc001.olot = tdltc.olot.prod
and tdltc001.orno = (:order)
order by tdltc001.olot, tdltc001.orno, tdltc001.ardt desc, tdltc001.clot desc
selectdo
if double.cmp(tdltc001.stoc, 0.0, 0.00001) = 0 then
endif selectempty
endselect
In the IF statement, I can find out the zero record. But how can I do to eliminate these in display form? In the other word, can I eliminate the zero record in SELECT statement. I tried to add this code:
and tdltc001.stoc > 0.00001
It did not take effect.

Hitesh Shah
28th October 2011, 13:59
IF tdltc001 is main table , the query extension u wrote must work . Else you write code in main.table.io / after.read section and do skip.io("") to skip to 0 qty lots .

tomlbacon
28th October 2011, 20:07
This will bypass and records with stock of 0.

field.tiitm001.cuni:
before.display:
select tdltc001.clot, tdltc001.olot, tdltc001.orno, tdltc001.item,
tdltc001.cprj, tdltc001.cntr, tdltc001.ardt, tdltc001.quam, tdltc001.stoc
from tdltc001
where tdltc001.olot = tdltc.olot.prod
and tdltc001.orno = (:order)
and tdltc001.stoc > 0
order by tdltc001.olot, tdltc001.orno, tdltc001.ardt desc, tdltc001.clot desc
selectdo
selectempty
endselect

Tom

JaapJD
29th October 2011, 00:44
Please specify your session type, form type and main table. I agree with Hitesh Shah that if the main table is tdltc001, the query.extension should work, however maybe you should move the assignment statement to init.form.
If tdltc001 is main table, then doing queries on that same table in field sections never will skip records and will also disturb the standard program if you don't use the on.main.table function around it.

assassinator
31st October 2011, 09:54
Thanks for all your replies. I had solved this problem. Maybe it was my ignorance.
before.program:
...
query.extension = "tdltc001.stoc > 0.00001"
on case order.type
case tckoor.act.sfc:
query.extension = "tdltc001.orno = :order and tdltc001.olot = tdltc.olot.prod"
break
case tckoor.act.sls:
query.extension = "tdltc001.item = :input.item"
break
endcase
But combine like this, it would work. I did not know it should be only one query extension for one table in before program.
...
query.extension = "tdltc001.orno = :order and tdltc001.olot = tdltc.olot.prod and tdltc001.stoc > 0"
...
query.extension = "tdltc001.item = :input.item and tdltc001.stoc > 0"