Hi Bruce
This is in a procedure routine which is called from the various Validate::variable routines in 5.Add Server Side Code here
The procedure routine is:
TTestForDuplicate ROUTINE
IF p_web.GSV('WAY:WaybillNumber') ='' OR p_web.GSV('WAY:WayCustID') ='0'
p_web._trace('waybill or custid blank')
ELSE
p_web._trace('waybill Number ' & p_web.GSV('WAY:WaybillNumber') & ' custid ' & p_web.GSV('WAY:WayCustID'))
access:WaybillAlias.Open()
Access:WaybillAlias.UseFile()
WAYALIAS:WaybillNumber=p_web.GSV('WAY:WaybillNumber')
WAYALIAS:WayCustID = p_web.GSV('WAY:WayCustID')
GET(WaybillAlias,WAYALIAS:KEY_CustomerIDWayBillNumber)
IF ERRORCODE()
p_web._trace('not found')
DuplicateFound=FALSE
ELSIF WAYALIAS:NoImage=FALSE
p_web._trace('waybill delivered')
p_web.Script('alert("This waybill has been delivered.Change the number");')
WaybillChanged=FALSE
DuplicateFound=TRUE
ELSE
p_web._trace('on another trip ')
p_web.Script('alert("This waybill exists on trip ' & p_web.GSV('WAYALIAS:TripID') & ' You cannot accept this Waybill");')
DuplicateFound=TRUE
END
IF DuplicateFound = TRUE
p_web.SSV('WAY:WaybillNumber','')
p_web.SSV('WAY:WayCustID',WAY:WayCustID)
END
Access:WaybillAlias.Close()
END