Re: Using a Record list -List box for selections of more than one field at a time.
Here's one more:
If you type
Vw_List("00023")
in the IW you can see what it does
Here is the function that you can import to the Code page - save it to your desktop
vw_List.txt
Here's one more:
Code:
FUNCTION Vw_List AS C(custid as C = "") 'DESCRIPTION: Get a list of devices for a cust_numb on the calling form 'Ex: Vw_List() will get the current cust_numb DIM shared dvcSerial as C DIM dlgbody as c DIM dlgcode as c DIM dlgresult as C DIM dlgtitle as c = "XD Example" if custid = "" then custid = topparent:cust_numb.value end if DIM dvcSerial_rl_def_orig as C dvcSerial_rl_def_orig = "kl=devices,{keylist_build(\"H=.05,1:10[Serial],2:12[Testable],3:10[Make],4:8[Size],5:15[Model],6:15[Location],7:20[Cross_Con],8:15[Hazard]\",''+serial,left(''+serial,10),left(''+type,10),left(''+make,10),left(''+size,8),left(''+model,15),left(''+location,15),left(''+cross_con,20),left(''+hazard,15))}{cust_numb = [varC->custid]}" DIM dvcSerial_rl_def as C dvcSerial_rl_def = replace_parameters(dvcSerial_rl_def_orig,local_variables()) dlgbody = <<%dlg% {removecomments} {background=Blue White} {can_exit=!CANCEL} {title=Record List} {watch=!custid_changed} {xmargin=2,1} {region} {Region} {'%O={F=Arial,9,B}{C=Dark Blue}Enter a Cust No. then select a record from list%}; {Endregion}; {Region} Cust No: [.15custid!custid_changed]; Select Serial No:; [%@dvcSerial_rl_def%.100,10dvcSerial]; Selection: [10dvcSerial]; {Endregion}; {line=1,0}; {lf}; {justify=center} <*12OK!OK> <12Cancel!CANCEL>; {endregion}; %dlg% dlgcode = <<%code% If a_dlg_button = "custid_changed" then dvcSerial_rl_def = replace_parameters(dvcSerial_rl_def_orig,local_variables()) a_dlg_button = "" end if %code% dlgresult = ui_dlg_box(dlgtitle,dlgbody,dlgcode) 'test button user selected 'msgbox("dlgresult",dlgresult) if dlgresult = "CANCEL" then end end if dim shared dvcCrosscon as c = "" dim shared dvcHazard as c = "" dim shared dvcLocation as c = "" dim shared dvcMake as c = "" dim shared dvcModel as c = "" dim shared dvcTestable as c = "" dim shared dvcType as c = "" dim fltr as c = "" dim idx as p dim msg as c = "" dim recs as n = 0 dim tbl as p 'SERIAL is your unique record key so open the table filtered 'and set the other 6 vars 'that are also defined in your form tbl = table.open("devices",FILE_RW_SHARED) tbl.index_primary_put("Serial") recs = tbl.fetch_find(dvcSerial) if recs < 1 then msgbox("Query Result","No records found for Serial #: "+dvcSerial,0) goto CLOSETBL end if msg = dvcSerial+crlf() dvcCrosscon = tbl.cross_con msg = msg+dvcCrosscon+crlf() dvcHazard = tbl.hazard msg = msg+dvcHazard+crlf() dvcLocation = tbl.location msg = msg+dvcLocation+crlf() dvcMake = tbl.make msg = msg+dvcMake+crlf() dvcModel = tbl.model msg = msg+dvcModel+crlf() dvcTestable = tbl.testable msg = msg+dvcTestable+crlf() dvcType = tbl.type msg = msg+dvcType+crlf() CLOSETBL: tbl.close() 'test populated vars msgbox("List",msg,0) Vw_List = dvcSerial END FUNCTION
Vw_List("00023")
in the IW you can see what it does
Here is the function that you can import to the Code page - save it to your desktop
vw_List.txt
Comment