CheckBoxView - Expression do not work
_Dejan_
Slovenia
hi,
I have problem with FastReport TfrxCheckBoxView. In database I have field which is varchar(1). there are four options:
a
l
c
z
I would like that when if record I have a that check box is checked.
Im try on Report checkbox item set next things:
DataSet=DBDataset1
DataField=stanje
Expression=<"DBDataset1"."stanje"> = 'a'
Bet I get error:
First chance exception at $7C812AFB. Exception class EVariantTypeCastError with message 'Could not convert variant of type (String) into type (Boolean)'. Process xxx.exe (3104)
What I doing wrong?
Thanks for any help.
I have problem with FastReport TfrxCheckBoxView. In database I have field which is varchar(1). there are four options:
a
l
c
z
I would like that when if record I have a that check box is checked.
Im try on Report checkbox item set next things:
DataSet=DBDataset1
DataField=stanje
Expression=<"DBDataset1"."stanje"> = 'a'
Bet I get error:
First chance exception at $7C812AFB. Exception class EVariantTypeCastError with message 'Could not convert variant of type (String) into type (Boolean)'. Process xxx.exe (3104)
What I doing wrong?
Thanks for any help.
Comments
Im already try this. Then I get next error:
The following error(s) occured: Unknown variable or datafield: "DBDataset1"."stanje"
field exist because I normaly show it on label...
P.S.
Im figure out my problem.
Im clear Dataset and DataField properties and change Expression to:
<DBDataset1."stanje"> = 'a'
select *, if mT.stanje = 'a' then 1 else 0 endif as FireCheckBox
from MyTables mT
and then use only DataSet and DataField (FireCheckBox) properties of TfrxCheckBoxView.
As you can have database column with values of N|Y or 0|non_zero to manage TfrxCheckBoxView status.
Try with FR compiled demo and test the query:
select * from orders order by custno, orderno
Assign AmountPaid to TfrxCheckBoxView and you see - rows with zero AmountPaid will not be checked.
Mick