Help with Report Filter on bit field

I have this filter for my report table:

expression                         operator         Value

=Cstr(Fields!work.Value)         =                        'True'

My report's table isn't returning data, but in preview but if I run the dataset, there is clearly some valid records tha contain 'true' for the field Work.  The field work in my SQL Server table is type bit

additional screenshot here: http:\\www.webfound.net\no_data_filter_on_bit_field.jpg




Answer this question

Help with Report Filter on bit field

  • JoeJ2

    Robert, thanks very much, it works. Now let me ask you this. I had a total textbox that just did a COUNT(number). But I need to do a COUNT on number if CBool(Fields!work.Value) = True. I was wondering how to form an if statement behind my text field to do this. number is just the identity field in which I can count on.



  • firemaker86

    I tried this but it's malformed:

    =IIf(CBool(First(Fields!home.Value, "Mismatch_Data")) == True, COUNT(Fields!number.Value, "Mismatch_Data"), 0)



  • crazy_one

    Do you really want to make the decision for the count based on the first data row value of the "home" field If yes, then this expression should work (note - since RDL expressions are VB.NET based the comparison only needs one '='; in this particular case you can also omit it):

    =IIf(CBool(First(Fields!home.Value, "Mismatch_Data")), COUNT(Fields!number.Value, "Mismatch_Data"), 0)

    Also, are you really looking for the Count or for a Sum aggregate

    If you want to sum individual rows based the value of the "home" field in that particular row (rather than just looking at the first row), you would use conditional aggregation and the following expression would need to be put e.g. into a table header/footer bound to the Mismatch_Data dataset):

    =Sum( iif(CBool(Fields!home.Value), Fields!number.Value, 0)

    -- Robert



  • WillSmith

    I would try the following filter:

    Expression:
        =CBool(Fields!work.Value)

    Operator:
        =

    Value:
        =True

    Note that the filter value is an expression (=True).

    -- Robert



  • Simon Ince

    Thanks, Robert. I was looking for the count of how many records were found. I have 2 tables....so I needed a count of records using the number field which was a unique field.

    That should work...



  • Help with Report Filter on bit field