I am trying to allow a user to set a default sort column that is used every time the user loads a grid instead of having a hard-coded default that has to be changed every time the grid is loaded. I made a simple dialog where the user can select a sort field from a pull-down which is saved to a preferences table. I am then looking up the value stored in this table for the "Order" preferences field of the grid but it is not working.
If I enter "description" (without quotes) in the order field of the grid properties the grid sorts by the description field with no problems. Now if I enter an expression to lookup the sort field from my preferences table it does not work
In the above order expression I hard coded the account number to 11642, if I run the above expression in interactive code window it returns "description".
I think it may have something to do with the fact that it is returning a character string. Just messing around I have tried the following to see what works
Once I get the above working I need to figure out how to use the account session variable instead of hard coding the account number. I have tried the following all with no luck
:Account_Num_svArg is an argument that is set to the value of session.svAccountNum
If I enter "description" (without quotes) in the order field of the grid properties the grid sorts by the description field with no problems. Now if I enter an expression to lookup the sort field from my preferences table it does not work
Code:
rtrim(lookupc("F", 11642, "sort_field", filename_decode("[PathAlias.ADB_Path]\customer_salesrep_pref.dbf"), "Account_Num")) <-- returns "description"
I think it may have something to do with the fact that it is returning a character string. Just messing around I have tried the following to see what works
Code:
if(.t.,description,description) <-- works if(.t.,"description","description") <-- does not work convert_type(description,"C") <-- works convert_type("description","C") <-- does not work, even though the quotes are not outputted from this function
Once I get the above working I need to figure out how to use the account session variable instead of hard coding the account number. I have tried the following all with no luck
Code:
rtrim(lookupc("F", session.svAccountNum, "sort_field", filename_decode("[PathAlias.ADB_Path]\customer_salesrep_pref.dbf"), "Account_Num")) rtrim(lookupc("F", :Account_Num_svArg, "sort_field", filename_decode("[PathAlias.ADB_Path]\customer_salesrep_pref.dbf"), "Account_Num"))
Comment