I have used this method several times before and they all have worked. I knocked up this one and the data is not displayed even thought the syntax is same as previous dialogs.
The five fields I am interested in the source table "Master" are as follows:
The Function fmtDisplayData for formatting the array data before display
Everything works, with the added trace.writeln command to display resulting Array confirming that correct data is being loaded into the array.
I get the Box drawn, no errors and .. No Data.
Must be something simple as the code looks identical to previous dialogs using this method, BUT I cant see it.
Can anyone spot what Im doing wrong or missed ?
Thanks
The five fields I am interested in the source table "Master" are as follows:
- N_Number Character 6
- Name Character 50
- Other_Name_1 Character 50
- City Character 18
- State Character 2
Code:
DIM SHARED vSearchReg as C dlg_title = "Search USCAR" dim ShowEnterFlag as l = .f. dim ShowDataFlag as l = .f. index = 0 ui_modeless_dlg_box(dlg_title,<<%dlg% {Background=#0+204+255} {Font=Bahnschrift,10,B} {region} <%T=Enter Reg Manually;O={J=C,C}{C=Brown}{F=Bahnschrift,10,B}{B=Tan}Enter%8,1!Enter_Reg_Pushed>{sp} <%T=Get Current Reg;O={J=C,C}{C=Gold}{F=Bahnschrift,10,B}{B=Dark Blue}Get%8,1!Get_Reg_Pushed>{sp} <%T=Run Query;O={J=C,C}{C=Black}{F=Bahnschrift,10,B}{B=Lime}Show%8,1!Run_query_pushed>{sp} <%T=Close Dialog;O={J=C,C}{C=Yellow}{F=Bahnschrift,10,B}{B=Red}Close%8,1!Close_dialog_pushed>; {endregion} {condition=(ShowEnterFlag=.t.)} {region} {sp=3}Reg:| [.16vSearchReg]; {endregion}; {condition=(ShowDataFlag=.t.)} [%O==[COLOR=#c0392b]FmtDisplayData[/COLOR](eval(value))%.100,5index^#vDisplayData!LookupSelect]; %dlg%,<<%code% if a_dlg_button = "Close_dialog_pushed" then ui_modeless_dlg_close(dlg_title) end if if a_dlg_button = "Enter_Reg_Pushed" then a_dlg_button = "" ShowEnterFlag = .t. ShowDataFlag = .f. end if if a_dlg_button = "Get_Reg_Pushed" then a_dlg_button = "" vSearchReg = ut(topparent:Reg.value) ShowEnterFlag = .t. ShowDataFlag = .f. end if if a_dlg_button = "Run_query_pushed" then a_dlg_button = "" vfilter = "n_number = "-Quote(ut(substr(vSearchReg,2))) vorder = "recno()" dim vDisplayData[0] as p vDisplayData.initialize_from_table("master",vFilter,vOrder) vDisplayData.resize(vDisplayData.first_empty()-1) [COLOR=#c0392b]trace.writeln(vDisplayData.dump_properties("N_Number|Name|Other_names_1|city|state")) added to confirm that correct data is in the Array[/COLOR] vSearchReg = "" ShowEnterFlag = .f. ShowDataFlag = .t. end if if a_dlg_button = "LookupSelect" then a_dlg_button = "" clipboard.Set_Data(vDisplayData[index].name) end if %code%)
Code:
FUNCTION fmtDisplayData AS C (ar AS P ) tab1 = "{T=1}" tab2 = "{T=2}" tab3 = "{T=3}" if right(ut(ar.name),3) = "DBA" then vName = ar.Other_names_1 else vName = ar.name end if fmtDisplayData = "N"+ar.n_number+tab1+vName+tab2+ar.city+tab3+ar.State END FUNCTION
I get the Box drawn, no errors and .. No Data.
Must be something simple as the code looks identical to previous dialogs using this method, BUT I cant see it.
Can anyone spot what Im doing wrong or missed ?
Thanks
Comment