Re: Conditional Table Lookup From selection?
I will try tomorrow, Keith.
I will try tomorrow, Keith.
Alpha Software Mobile Development Tools: Alpha Anywhere | Alpha TransForm |
'Create an XDialog dialog box to prompt for parameters. DIM SHARED vc_class as C DIM SHARED vc_description as C DIM SHARED varC_result as C auto_list_vc_class = table.external_record_content_get("fabric_class","Classification","classification","") temp_count = w_count(auto_list_vc_class,crlf()) DELETE a_vc_class DIM a_vc_class[temp_count] as c a_vc_class.initialize(auto_list_vc_class) ok_button_label = "&OK" cancel_button_label = "&Cancel" varC_result = ui_dlg_box("Classifaction Selector",<<%dlg% {region} Select Clssification:| [.40,5vc_class^#a_vc_class]; Enter Description:| [.100vc_description]; {endregion}; {line=1,0}; {region} <*15=ok_button_label!OK> <15=cancel_button_label!CANCEL> {endregion}; %dlg%) 'Conditional code follows. Executes only if the condition expression is True. IF a5_eval_expression("=Var->varC_result=\"Cancel\"",local_variables()) THEN 'End the current script END END IF 'Execute inline Xbasic code. dim vc_code as c 'debug(1) dim global vc_class_no as n vc_class_no=lookup("Fabric_Class","Classification= "+s_quote(vc_class) ,"Lastused") 'debug(1) dim tblb as p tblb = table.open("fabric_class",FILE_RW_EXCLUSIVE) tblb.query_detach_all() query.description = "Classificationn" query.order = "Classification" query.filter = "Classification= "+s_quote(vc_class) query.options = "D" tblb.query_create() lastnum = vc_class_no nextnum = lastnum+1 tblb.change_begin() tblb.Lastused = nextnum tblb.change_end(.t.) tblb.close() vc_code=nextnum 'nextnum=nextnum+vc_style_no tbla = table.open("Fabric_codes") tbla.enter_begin(.t.) tbla.sm_fab_code = left(vc_class,1)+alltrim(str(var->vc_code)) tbla.fabric_description=vc_description tbla.enter_end(.t.) 'Displays a message box (style:'OK Button', image: 'Information symbol', id: 'msg2'). DIM SHARED msg2_result as N DIM SHARED msg2_OK_Button as L msg2_OK_Button = .F. title_var = "SM Fabric Code" 'Message is an expression. Need to evaluate the expression in the context of the current form. message_text_var = a5_eval_expression("=\"You have saved \"+left(Var->vc_class,1)+Var->vc_code+crlf(1)+Var->vc_description",local_variables()) msg2_result=ui_msg_box(title_var,message_text_var,UI_OK+ UI_FIRST_BUTTON_DEFAULT+ UI_INFORMATION_SYMBOL) 'Test to see which button on the message box was pressed.... SELECT CASE msg2_result = UI_OK_SELECTED msg2_OK_Button= .t. END SELECT f
Comment