Morning All,

adapting code that has worked for me before, I now only get a blank result array displayed and it seems the function is not called, but I cannot see why.
Any input welcomed. you wont be able to run this script as it makes two lookups to two of my tables. It all works up to the point of displaying result, i.e. vFilter creates the ResultArray correctly.

Code:
DIM SHARED vCountry as C
DIM SHARED vArmName as C
vColumns = <<%a%
Operator
tail_code
Group
Wing
Regiment
base_unique
%a%
vFormat = stritran(crlf_to_comma(vColumns),",","|")
showResults = .f.
index = 0  
DIM vCountryDef as C  = "kl=prefix,{keylist_build("H=.05,1:25",''+name12,left(''+country,25))}{Usage_C = .t.}"
DIM vArmNameDef_orig as C = "kl=air_arm_name,{keylist_build("H=.05,1:25",''+arm_name,left(''+arm_name,25))}{country = [varC->vCountry]}"
DIM vArmNameDef as C  = replace_parameters(vArmNameDef_orig,local_variables())
dlg_title = "Select Air Arm"
ui_modeless_dlg_box(dlg_title,<<%dlg%
{Background=#244+255+244}
{region}
[%@vCountryDef%.40,5vCountry!vCountry_changed];
{endregion}
{region}
{sp=1}[%@vArmNameDef%.40,5vArmName];
{endregion};
{condition=(showResults=.t.)}
{region}
[%O==FmtAppendixC(eval(value))%.82,16index^#ResultArray]
{endregion};
{condition=.t.}
{region}
<%T=Run Query;O={J=C,C}{I:'$$table.search'};OF={J=C,C}{I:'$$code.execute.blue'}%!GO_button_pushed>
<%T=Close Dialog;O={J=C,C}{I:'$$generic.exit'};OF={J=C,C}{I:'$$window.close'}%!Close_button_pushed>
{endregion};
%dlg%,<<%code%
if a_dlg_button ="Close_button_pushed" then
    ui_modeless_dlg_close(dlg_title)
    a_dlg_button = ""
end if
If a_dlg_button = "vCountry_changed" then 
    vArmNameDef = replace_parameters(vArmNameDef_orig,local_variables())
    a_dlg_button = ""
end if
if a_dlg_button = "GO_button_pushed" then
    vFilter = "Country="-quote(alltrim(vCountry))+".and.arm_name="-quote(alltrim(vArmName))
    dim resultArray[0] as p
    resultArray.get_dynamic()
    vOrder  = "Operator"
    resultArray.initialize_from_table("Appendix_c",vFilter,vOrder,vColumns)
    showvar(resultArray.dump_properties(vFormat)) ' displays records correctly
    showResults = .t.
    a_dlg_button = "" 
end if
%code%)
Code:
FUNCTION FmtAppendixC AS C (ar AS P )
    tab1 = "{T=2}"
    tab2 = "{T=2.5}"
    tab3 = "{T=3.2}"
    showvar(tab3) ' just me testing to show if function has been called
    if rtrim(ar.base_unique) = "" then
        baseName = lookupc("f",ar.base_unique,"base","base_details","Unique")
        else
        baseName = ""
    end if
FmtAppendixC = ar.operator+tab1+ar.tail_code+tab2+baseName
END FUNCTION