smusba
15th March 2011, 15:17
I want to write a script in such a way that if the (tdpur041.pono) position no 1 starts with tdpur041.item(1;1) ="1" then the concurring position should start with 1 itself other than 1 it should give error message and enable to input.

field.tdpur996.pono.c:
check.input:
for i = 1 to 100

if tdpur041.item(1;1)<>tdpur041.item(1;1)then

|if tdpur041.item(1;1)<>tdpur041.item(1;1)then
set.input.error("")
message("Make different Orders for Fish and shrimps")
else
endif
endfor
Kindly help me with the script.

mark_h
15th March 2011, 15:59
Not sure I get this are you saying if the first position on a purchase order has an item that starts with "1" - then any new items added to the order must start with 1?

sameer.don
16th March 2011, 07:26
Hi,
What I can understand from you question is, all the items in a PO should be of same series. And all should start with same character as that of first line.
In this case, you will need to make use of variable to hold the item code used in position 1. Code should look like:

string first.item(16), curr.item(16)

field.tdpur041.orno:
after.display:
|* SQL to read item code of first PO Line
first.item = ""
select tdpur041.item:first.item
from tdpur041
wehre tdpur041._index1 = {:tdpur041.orno}
order by tdpur041._index1
as set with 1 rows
endselect

field.tdpur041.item:
check.input:
if not (tdpur041.pono = 1 and update.status = add.set) then
curr.item = strip$(shiftl$(tdpur041.item)
if curr.item(1;1) = first.item (1;1) then
|*** error message
endif
endif