CheckBoxView - Expression do not work

_Dejan__Dejan_ Slovenia
edited 12:44PM in FastReport 4.0
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.

Comments

  • gpigpi
    edited 12:44PM
    Clear Dataset and DataField properties
  • _Dejan__Dejan_ Slovenia
    edited April 2011
    gpi wrote: »
    Clear Dataset and DataField properties

    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'
  • edited 12:44PM
    If your database engine syntax allows calculated fileds then try similar construction:

    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

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.