Evaluating bit fields in SSRS

  • Can SSRS evaluate a bit field without having to specify the comparison?

    Example: =IIF( Fields!IsState.Value and Fields!RegionID.Value <>"12","Yes","No")

    In this example IsState is a bit field and is not being compared to a value like RegionID is being compared to "12". Is this statement saying if IsState and RegionID is not equal to 12 then Yes else No. Or is IsState automatically being evaluated again "True" since nothing is explicitly specified to evaluate against it?

  • i believe this is the equivalent; the first test is evaluating whether it's boolean, so the first part of your test is just checking if the value is zero or non zero:

    Example: =IIF( Fields!IsState.Value <> 0 and Fields!RegionID.Value <>"12","Yes","No")

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • It is a boolean so I would imagine this is then evalutating IsState.Value <> False?

  • dawidajm (6/4/2013)


    It is a boolean so I would imagine this is then evalutating IsState.Value <> False?

    i believe under the covers , false is zero, and true is anything not zero, right? so there;s some implicit conversions going on to get it to fit into a boolean datatype.

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • Lowell (6/4/2013)


    dawidajm (6/4/2013)


    It is a boolean so I would imagine this is then evalutating IsState.Value <> False?

    i believe under the covers , false is zero, and true is anything not zero, right? so there;s some implicit conversions going on to get it to fit into a boolean datatype.

    False is zero and true is 1. I don't think it can be anything outside of 1 and still evaluate to true.

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply