Hi all,
In my cmdprint.click event, I'd like to pass in a variable to the select statement to dynamically sort the order of the cursor, so it looks like this:
LPARAMETERS lcorder
lcorder = ALLTRIM(STR(this.Parent.myorder))
&& this.Parent.myorder is a number, such as 1 or 2,3,4...
select * FROM curcustomer ;
order BY (&lcorder) into CURSOR rpcurcust
This works, but if I want to do something like this
LPARAMETERS lcorder
lcorder = ALLTRIM(STR(this.Parent.myorder))
if lcorder='2'
lcorder=lcorder+ ' Desc' && to sort the column in descent
endif
select * FROM curcustomer ;
order BY (&lcorder) into CURSOR rpcurcust
then VFP gives me an error, stating that there are so many parameters that the right parenthesis ) is not recognized.
I can work around by repeating the select statement for each case, but it doesn't look nice. Any suggestions?
Thanks.
In my cmdprint.click event, I'd like to pass in a variable to the select statement to dynamically sort the order of the cursor, so it looks like this:
LPARAMETERS lcorder
lcorder = ALLTRIM(STR(this.Parent.myorder))
&& this.Parent.myorder is a number, such as 1 or 2,3,4...
select * FROM curcustomer ;
order BY (&lcorder) into CURSOR rpcurcust
This works, but if I want to do something like this
LPARAMETERS lcorder
lcorder = ALLTRIM(STR(this.Parent.myorder))
if lcorder='2'
lcorder=lcorder+ ' Desc' && to sort the column in descent
endif
select * FROM curcustomer ;
order BY (&lcorder) into CURSOR rpcurcust
then VFP gives me an error, stating that there are so many parameters that the right parenthesis ) is not recognized.
I can work around by repeating the select statement for each case, but it doesn't look nice. Any suggestions?
Thanks.