copied this code from the documentation, but it has an error and I dont know what it is, can anyone help me please?
the line
[%O==testFNvalue?%.50,5index^#arr]
doesnt work for some reason, although it is coded as stated in the documentation example.
The original document is available at http://wiki.alphasoftware.com/Xdialog+ListBoxes+Dynamically+Computing+the+Display+Expression+V10
dim arr[0] as p
arr[].fname = "Sam"
arr[..].lname = "Raven"
arr[].fname = "Charles"
arr[..].lname = "Chambliss"
arr[].fname = "Dion"
arr[..].lname = "Smits"
index = 1
dim fmt as c = ".fname"
ui_dlg_box("Owner Draw Listbox - Computed Display",<<%dlg%
{wrap=40}
{repaint_begin=fmt}
Select the property to display:;
[.10fmt^={.fname,.lname}];
[%O==eval(value+fmt)%.50,5index^#arr];
Listbox can show an expression showing a calculation involving properties in the array:;
[%O==eval(value+".fname+' '+" + value + ".lname" )%.50,5index^#arr];
A more complex expression:;
[%O==eval("upper(" + value+".fname)+' '+" + value + ".lname" )%.50,5index^#arr];
You can call a UDF to compute the data to display:;
\(This is the most flexible option.);
[%O==testFNvalue?%.50,5index^#arr];
{repaint_end}
%dlg%)
'value is a placeholder for 'arr'. eval(value) passes in the the current row in the array to the function.
function testFN as c (ar as p)
testFN = upper(ar.lname) + ", " + f_upper(ar.fname)
if ar.lname = "chambliss" then
testFN = "{I:'$$generic.orb.green.small'} " + testFN
else
testFN = "{I:'$$generic.orb.blue.small'} " + testFN
end if
end function
arr[].fname = "Sam"
arr[..].lname = "Raven"
arr[].fname = "Charles"
arr[..].lname = "Chambliss"
arr[].fname = "Dion"
arr[..].lname = "Smits"
index = 1
dim fmt as c = ".fname"
ui_dlg_box("Owner Draw Listbox - Computed Display",<<%dlg%
{wrap=40}
{repaint_begin=fmt}
Select the property to display:;
[.10fmt^={.fname,.lname}];
[%O==eval(value+fmt)%.50,5index^#arr];
Listbox can show an expression showing a calculation involving properties in the array:;
[%O==eval(value+".fname+' '+" + value + ".lname" )%.50,5index^#arr];
A more complex expression:;
[%O==eval("upper(" + value+".fname)+' '+" + value + ".lname" )%.50,5index^#arr];
You can call a UDF to compute the data to display:;
\(This is the most flexible option.);
[%O==testFNvalue?%.50,5index^#arr];
{repaint_end}
%dlg%)
'value is a placeholder for 'arr'. eval(value) passes in the the current row in the array to the function.
function testFN as c (ar as p)
testFN = upper(ar.lname) + ", " + f_upper(ar.fname)
if ar.lname = "chambliss" then
testFN = "{I:'$$generic.orb.green.small'} " + testFN
else
testFN = "{I:'$$generic.orb.blue.small'} " + testFN
end if
end function
[%O==testFNvalue?%.50,5index^#arr]
doesnt work for some reason, although it is coded as stated in the documentation example.
The original document is available at http://wiki.alphasoftware.com/Xdialog+ListBoxes+Dynamically+Computing+the+Display+Expression+V10
Comment