Hi all,
I have a rather challenging issue that has me stuck. See the form below.
screenshot.bmp
I'm trying to implement "shortcuts" on a form that upon selection, fill corresponding fields. The shortcuts are records in another table that are referenced and then via a look-up are set to field values on this form. I was successful in completing this and have copied the xbasic below for reference.
Each 'part' consists of 3 fields to be updated: 1) quantity 2) part number 3) description
The challenge is to write some sort of IF statement that will check if field 1 (2/3/4/etc) is already occupied, if so, it will fill the next instead of over-writting it. Basically to +1 the field references if necessary. Up to this point I've only been using the Genies and have taken the genie's Xbasic and modified it resulting in the code below. I have done this for all 15 parts in the table although only 2 are listed here. I am very new at Xbasic so hopefully there is an easy way to do what I'm describing.
'Set Value of 1st part
DIM form_name as c
if is_object(topparent.this) then
form_name = topparent.name()+".this"
else
form_name = ""
end if
'part1
DELETE expression_result
expression_result = eval("lookupc('F',alltrim(Var->RS)+alltrim(outgoing_part_number),'rpartdesc1','repair shortcuts','rs')",form_name)
parentform:Rpartdesc1.value = expression_result
DELETE expression_result
expression_result = eval("lookupc('F',alltrim(Var->RS)+alltrim(outgoing_part_number),'rpartnum1','repair shortcuts','rs')",form_name)
parentform:Rpartnum1.value = expression_result
DELETE expression_result
expression_result = eval("lookupn('F',alltrim(Var->RS)+alltrim(outgoing_part_number),'rpartqty1','repair shortcuts','rs')",form_name)
parentform:Rpartqty1.value = expression_result
'part2
DELETE expression_result
expression_result = eval("lookupc('F',alltrim(Var->RS)+alltrim(outgoing_part_number),'rpartdesc2','repair shortcuts','rs')",form_name)
parentform:Rpartdesc2.value = expression_result
DELETE expression_result
expression_result = eval("lookupc('F',alltrim(Var->RS)+alltrim(outgoing_part_number),'rpartnum2','repair shortcuts','rs')",form_name)
parentform:Rpartnum2.value = expression_result
DELETE expression_result
expression_result = eval("lookupn('F',alltrim(Var->RS)+alltrim(outgoing_part_number),'rpartqty2','repair shortcuts','rs')",form_name)
parentform:Rpartqty2.value = expression_result
I have a rather challenging issue that has me stuck. See the form below.
screenshot.bmp
I'm trying to implement "shortcuts" on a form that upon selection, fill corresponding fields. The shortcuts are records in another table that are referenced and then via a look-up are set to field values on this form. I was successful in completing this and have copied the xbasic below for reference.
Each 'part' consists of 3 fields to be updated: 1) quantity 2) part number 3) description
The challenge is to write some sort of IF statement that will check if field 1 (2/3/4/etc) is already occupied, if so, it will fill the next instead of over-writting it. Basically to +1 the field references if necessary. Up to this point I've only been using the Genies and have taken the genie's Xbasic and modified it resulting in the code below. I have done this for all 15 parts in the table although only 2 are listed here. I am very new at Xbasic so hopefully there is an easy way to do what I'm describing.
'Set Value of 1st part
DIM form_name as c
if is_object(topparent.this) then
form_name = topparent.name()+".this"
else
form_name = ""
end if
'part1
DELETE expression_result
expression_result = eval("lookupc('F',alltrim(Var->RS)+alltrim(outgoing_part_number),'rpartdesc1','repair shortcuts','rs')",form_name)
parentform:Rpartdesc1.value = expression_result
DELETE expression_result
expression_result = eval("lookupc('F',alltrim(Var->RS)+alltrim(outgoing_part_number),'rpartnum1','repair shortcuts','rs')",form_name)
parentform:Rpartnum1.value = expression_result
DELETE expression_result
expression_result = eval("lookupn('F',alltrim(Var->RS)+alltrim(outgoing_part_number),'rpartqty1','repair shortcuts','rs')",form_name)
parentform:Rpartqty1.value = expression_result
'part2
DELETE expression_result
expression_result = eval("lookupc('F',alltrim(Var->RS)+alltrim(outgoing_part_number),'rpartdesc2','repair shortcuts','rs')",form_name)
parentform:Rpartdesc2.value = expression_result
DELETE expression_result
expression_result = eval("lookupc('F',alltrim(Var->RS)+alltrim(outgoing_part_number),'rpartnum2','repair shortcuts','rs')",form_name)
parentform:Rpartnum2.value = expression_result
DELETE expression_result
expression_result = eval("lookupn('F',alltrim(Var->RS)+alltrim(outgoing_part_number),'rpartqty2','repair shortcuts','rs')",form_name)
parentform:Rpartqty2.value = expression_result
Comment