mattan
4th August 2004, 11:31
I am trying to check the status of PO lines so that any PO line that has a status less than 3 "Maintain Receipts", I will do a task.
In my script below, the fourth statment is not working. once i remark off this statment, the program will then perform the task
select tdpur045.*
from tdpur045 for update
where tdpur045._index1 = {:tdpur041.orno, :tdpur041.pono}
and tdpur045.spur < 3
selectdo
<task>.................................
.................................
endselect
Can anyone advice
SriksAdi
4th August 2004, 13:01
Hi,
Nothing seems to be wrong with the SQL.
What exactly is the problem your facing ?
regards
Sriks
mark_h
4th August 2004, 14:56
Just be careful with that query - you should check the status on the last sequence(or receipt) on the purchase order. What are your order steps (tcmcs0142m000)? Check the order type you are looking at and make sure there is a status that may be less than 3.
Mark
mattan
5th August 2004, 08:32
in our po order steps, status 1 is print purchase order and status 3 is maintain receipts.
when i print po with status 1 the message is always "I am sad", basically all the test that i do irregardless of the status will churn out result "I am sad".
Somehow the program is not recognising the statement of "and tdpur045.spur < 3".
I am really puzzle?
select tdpur045.*
from tdpur045 for update
where tdpur045._index1 = {:tdpur041.orno, :tdpur041.pono}
and tdpur045.spur < 3
selectdo
message ("I am happy")
selectempty
message ("I am sad")
endselect
SriksAdi
5th August 2004, 08:42
hi,
Try this out :
Remove line 4 from your query. (and tdpur045.spur < 3)
Change message("I am happy") to message("Status : " & str$(tdpur045.spur))
Execute the statement and check what's the message displayed.
regards
Sriks
Moon Lok
5th August 2004, 10:28
Hi,
I am not so sure.
Try replace
and tdpur045.spur < 3
with
and (tdpur045.spur = stno.4401 or tdpur045.spur = stno.4410)
regards
Moon :)
mark_h
5th August 2004, 14:31
I went and looked up how I check the status:
|* Check line status
select tdpur045.spur, tdpur045.srnb, tdpur045.date
from tdpur045
where tdpur045._index1 = {:purch.order, :purch.line}
order by tdpur045.srnb desc
as set with 1 rows
selectdo
endselect
if tdpur045.spur>=tcmcs039.stno and tdpur045.spur <= 9 then
return(true)
else
return(false)
endif
I took your query and put it into easy sql with just this and it worked:
select tdpur045.*
from tdpur045
where tdpur045.spur < 3
Mark