Hi!
I have made a script to be used in a form (triggered by button) where I can search for a productid, and if found the product's inventory are increased by a fixed amount.
All this is pretty straightforward stuff I guess, but
what I need help for is how to make the condition if a product is not found through the locate text , how stop the adding to the inventory.
Could off course make to button scripts but I guess there is an easy solution.
I have enclosed the xbasic for both locate text and the set field value from the code editor.
Hope someone can help me.
Regards
Kim
*********Locate text:
'Locate Text in a field in a record in current form.
dim pObj as p
'get a pointer to the current window
pObj = topparent.this
dim TextToLocate as c
TextToLocate = ui_get_text("Locate What","Select text to locate")
if TextToLocate = "" then
end
end if
if TextToLocate = "" then
ui_msg_box("Error","You must specify non-blank text to Locate.",UI_STOP_SYMBOL)
end
end if
dim tbl as p
tbl = pObj.table_get()
dim locateFlag as l
locateFlag = tbl.fetch_loc_next(TextToLocate)
if locateFlag = .t. then
pObj.resynch()
else
ui_msg_box("Note","Text not found.",UI_INFORMATION_SYMBOL)
end if
*********Set Field values script
'Set 'Value' property of 'Antall' in Form 'Untitled' .
DIM form_name as c
if is_object(topparent.this) then
form_name = topparent.name()+".this"
else
form_name = ""
end if
DELETE expression_result
expression_result = eval("Antall+1",form_name)
topparent:Antall.value = expression_result
I have made a script to be used in a form (triggered by button) where I can search for a productid, and if found the product's inventory are increased by a fixed amount.
All this is pretty straightforward stuff I guess, but
what I need help for is how to make the condition if a product is not found through the locate text , how stop the adding to the inventory.
Could off course make to button scripts but I guess there is an easy solution.
I have enclosed the xbasic for both locate text and the set field value from the code editor.
Hope someone can help me.
Regards
Kim
*********Locate text:
'Locate Text in a field in a record in current form.
dim pObj as p
'get a pointer to the current window
pObj = topparent.this
dim TextToLocate as c
TextToLocate = ui_get_text("Locate What","Select text to locate")
if TextToLocate = "" then
end
end if
if TextToLocate = "" then
ui_msg_box("Error","You must specify non-blank text to Locate.",UI_STOP_SYMBOL)
end
end if
dim tbl as p
tbl = pObj.table_get()
dim locateFlag as l
locateFlag = tbl.fetch_loc_next(TextToLocate)
if locateFlag = .t. then
pObj.resynch()
else
ui_msg_box("Note","Text not found.",UI_INFORMATION_SYMBOL)
end if
*********Set Field values script
'Set 'Value' property of 'Antall' in Form 'Untitled' .
DIM form_name as c
if is_object(topparent.this) then
form_name = topparent.name()+".this"
else
form_name = ""
end if
DELETE expression_result
expression_result = eval("Antall+1",form_name)
topparent:Antall.value = expression_result
Comment