Medtun
21st January 2016, 16:53
Hi,

I would add a new field(whwmd530.idat) to a report(whwmd543001000).
This field exists in the same record in table whwmd530 as the other fields displayed in the report.
I tried the code below. It works. but only if i specify whwmd530._index1 = "LR15091102568".
If i set whwmd530._index1 = {:whwmd530.huid}, it doesn't work.


select whwmd530.idat

from whwmd530

where whwmd530._index1 = {:whwmd530.huid} |"LR15091102568"

selectdo

IF whwmd530.idat < utc.num()

THEN F10 = whwmd530.idat

ENDIF

endselect

Do i have to use db.curr() ? if yes, can you please tell me how we can write it ?
I found no examples on the forum.

Thanks.

JaapJD
21st January 2016, 19:50
Try this:

where whwmd530._index1 = {:lb.handl.unit}

Medtun
22nd January 2016, 10:44
Thank yoy JaapJD,
I already tried it.
I gets : Error SQL: SQLState 42I03: Unknown column 'lb.handl.unit' (error 302).
Even so lb.handl.unit exists in report input fields and then should be existing in RAM.

Ajesh
22nd January 2016, 11:05
Are you using this code in a program script? I mostly think you are.Before trying to select the field why dont you assign the whwmd530.huid to a local variable and then use it in the selection.Something like

hold.huid = whwmd530.huid
select whwmd530.idat
from whwmd530
where whwmd530._index1 = {:hold.huid} |"LR15091102568"
selectdo
IF whwmd530.idat < utc.num()
THEN F10 = whwmd530.idat
ENDIF
endselect


Or try a Temporary table selection instead of using a main table field on the selection of the same table.

Something like


hold.huid = whwmd530.huid
select w530.idat :whwmd530.idat
from w530 whwmd530
where w530._index1 = {:hold.huid} |"LR15091102568"
selectdo
IF whwmd530.idat < utc.num()
THEN F10 = whwmd530.idat
ENDIF
endselect

Medtun
22nd January 2016, 11:09
Ah sorry.
I tried it with lb.handl.unit. But not with {:lb.handl.unit}.
Now with {:lb.handl.unit} it works.

Thanks.