Hi,
My present problem is how to reduce the size of the next script I will be writing and am hoping someone can steer me to a better way.
The first script will work for using a variable for a filter but as I have at least 6 different filters to add to this the amount of script will be quite large. If I could use variables to equal each filter as in the second script (which DOES NOT work!) the amount of work needed will be reduced quite a bit and be much cleaner too I might add.
Client_info and Sel_prod_type are tables in the report set.
rvAll, rvComp, and rvPrd_Type are character global variables and are for sure set.
The following script does not work--error of "Arguement is incorrect data type" ... but will if only one of the variables is passed as the filter.
I have tried quoting in various ways and have gotten other errors as a result but think this example will at least show what I am after....a filter that is a result of variables that are equal to logical field's values.
Help or direction of any kind would be great!
Mike
My present problem is how to reduce the size of the next script I will be writing and am hoping someone can steer me to a better way.
The first script will work for using a variable for a filter but as I have at least 6 different filters to add to this the amount of script will be quite large. If I could use variables to equal each filter as in the second script (which DOES NOT work!) the amount of work needed will be reduced quite a bit and be much cleaner too I might add.
Client_info and Sel_prod_type are tables in the report set.
rvAll, rvComp, and rvPrd_Type are character global variables and are for sure set.
Code:
dim Com_cnt as n Com_cnt= tablecount("client_info","client_chb") if Com_cnt = 0 then rvAll="Client_Info->Client_chb = .T." 'Client_chb is a logical checkbox else rvAll="Client_Info->Client_chb=.T. .And. sel_prod_type->Chbx_Ptype=.T." 'Chx_Ptype is a logical checkbox end if dim PType_cnt as n PType_cnt=tablecount("sel_prod_type","Chbx_Ptype") if PType_cnt=0 then rvAll = "Client_Info->Client_chb=.T." else rvAll = "sel_prod_type->Chbx_Ptype=.T. .And. Client_Info->Client_chb=.T." end if query.filter = rvAll query.order = "recno()" :Report.Preview("APT_Inc",query.filter,query.order)
Code:
dim Com_cnt as n Com_cnt= tablecount("client_info","client_chb") if Com_cnt = 0 then rvComp="" else rvComp="Client_Info->Client_chb=.T." end if dim PType_cnt as n PType_cnt=tablecount("sel_prod_type","Chbx_Ptype") if PType_cnt=0 then rvPrd_Type="" else rvPrd_Type="sel_prod_type->Chbx_Ptype=.T." end if query.filter = rvComp .and. rvPrd_Type'works if only ONE variable is listed. query.order = "recno()" :Report.Preview("APT_Inc",query.filter,query.order)
Help or direction of any kind would be great!
Mike
Comment