Been hitting the books’n’vidoes, but I’m back again. The original challenge was, in entering a new invoice in the AR file, the look-up of a customer ID from the Customer file, to handle the situation where more than one customer in the Customer File has the same last name (but different ID) than the customer whose invoice you’re entering in the AR file, and how to procure the desired customer ID for this invoice.
The below (“3d Time”) works fine as a standalone procedure with the AR file’s input (new record) form. I’ve split the 3 scenarios (no such name, one name, more than one name) into an elseif construction.
|||||-----------------
let searchname = “” //clean slate for local//
gettextdialog searchname,“Prompt”, “Last Name?”
if info(“dialogtrigger”) = “Cancel”
rtn
endif
let CustomerIDArray = arraybuild(cr(), “WBPS Customers”, {«Cus ID»+"……"+«F Name»+" ("+«City»+")"}, {«L Name» match searchname})
;message CustomerIDArray //confirms array
;message CustomerIDArray[1,6] //confirms value for «CUSID»
If CustomerIDArray= “”
message “Try Again?”
rtn
elseif arraysize(CustomerIDArray,cr()) = 1
message “Jes’ one”
«CUS ID» = CustomerIDArray[1,6]
;message «CUS ID»
elseif arraysize(CustomerIDArray,cr())>= 2
message “Too Many”
rtn
endif
-----------------|||||
However, this procedure really wants to be executed once «Name» has been filled out in the Input form. It wants to be in the procedure pane of the Properties panel for «Names»'s Text Edit Object.
For that very little has to be changed except for the “Name” value (in the standalone: “searchname,” in the TEO: «Name»). I ditched the standalone’s query ({«L Name» match searchname}) for a straight lookup, for this reason.
|||||-----------------
let CustomerIDArray = arraybuild(cr(), “WBPS Customers”, {«Cus ID»+"……"+«F Name»+" ("+«City»+")"}, {lookup(“WBPS Customers”,«L Name»,«Name»,«Cus ID»)})
message CustomerIDArray
message CustomerIDArray[1,6]
if arraysize(CustomerIDArray,cr()) = 1
message “Jes’ one”
«CUS ID» = CustomerIDArray[1,6]
message «CUS ID»
endif rtn
if arraysize(CustomerIDArray,cr())>= 1
message “Too Many”
endif
-----------------|||||
Because the procedure isn’t executed until tabbing out of that field, the “name” value used in the array’s lookup query, it should be available. But I get the alert “Field or variable ‘Name’ does not exist”.
Even if I try to employ a "Call ‘3d Time’ " in the procedure pane (which DOES work as a standalone) it says the procedure doesn’t exist ("Call Statement Failed, procedure 3d time does not exist.
Any hints will be appreciated.