locked
Make TextBox visible, if at least one value from field (bool) is true RRS feed

  • Question

  • Hi,

    I have to set visibility on one TextBox. It depends on one field in dataset - "Type" (bit, 0 or 1).

    If at least one value is "1", then TB should be visible. In other cases (all values = 0), it should be hidden.

    This expression is not working:

    =IIF(Fields!ubp_type.Value,"true","false")

    because field "Fields!ubp_type.Value" return only one value. (if there is at least one "False", it returns false) :/

    Friday, June 22, 2012 9:28 AM

Answers

  • Hi there

    =IIF (
        sum(cint(Fields!ubp_type.Value),"dataset1")>=1,
        false,
        true
    )

    Where Dataset1 is your datset name

    I hope this will work

    many thanks

    Syed

    • Marked as answer by simon17 Friday, June 22, 2012 10:57 AM
    Friday, June 22, 2012 10:14 AM

All replies

  • Hi Simon,

    The problem is the way you have stated true or false... They are not string literals and hence shouldnt be encapsulated in quotes.

    Please rewrite your expression to:

    =IIF (
        Fields!ubp_type.Value,
        false,
        true
    )

    Alternatively, if you want to check for either of the two fields being 1, then you can include the other field in your expression as:

    =IIF (
        Fields!ubp_type.Value Or Fields!second_field.Value,
        false,
        true
    )

    HTH.

    Cheers,

    IceQB


    Please mark correct answers :)

    Friday, June 22, 2012 9:37 AM
  • Hi There

    i think it might be like this

    =IIF(Fields!ubp_type.Value=0,"true","false")

    =IIF(Fields!ubp_type.Value=0,"true","false")

    Many thanks

    Syed

    Friday, June 22, 2012 9:46 AM
  • Thanks for reply!

    Of course, I wrote expression without quotes, like You mentioned.

    =IIF(Fields!ubp_type.Value,true,false)

    I made mistake during writing this quetions..

    There is just one Field (dataset) - "Fields!ubp_type.Value", which has many values. It tells us, if the client is company (0), or not (1).

    When I put this field into table, then it has few rows:

    Name          Type

    Client1           0

    Client2           1

    Client3           1

    Client4           0

    If at least one client has type: "1", then one textBox should be visible.

    Friday, June 22, 2012 9:46 AM
  • Hi There

    Thanks for your posting. Your question is not clear enough I think , can you please give some more details, Where does you put that textbox which you would like to hide? Is it the part of your table or a textbox outside the table. Is it just one textbox you are trying to hide?

    So if you have at least one value =1 in your data set your text box will be visible?

    Please give some more details.

    Many thanks

    Syed

    Friday, June 22, 2012 9:56 AM
  • I've tried before in many ways:

    =IIF(Fields!ubp_type.Value=0, true, false)

    =IIF(Fields!ubp_type.Value<>0, true, false)

    =IIF(Fields!ubp_type.Value, true, false)

    but none is working

    Friday, June 22, 2012 10:04 AM
  • Yes, there is just one TextBox, outside the table.

    Yes, if I have at least one value =1 in my data set my text box will be visible.

    Friday, June 22, 2012 10:07 AM
  • Hi there

    =IIF (
        sum(cint(Fields!ubp_type.Value),"dataset1")>=1,
        false,
        true
    )

    Where Dataset1 is your datset name

    I hope this will work

    many thanks

    Syed

    • Marked as answer by simon17 Friday, June 22, 2012 10:57 AM
    Friday, June 22, 2012 10:14 AM
  • Thanks, it's working! :)

    I don't know why, it casts TRUE into -1, so I changed it a little bit ;)

    =IIF (
        sum(cint(Fields!UB_ubp_type.Value),"dataset1")<=-1,
        false,
        true
    )

    Before I've also tried to sum, but without casting (cint). I was sure, that it should sum up Booleans :/



    • Edited by simon17 Friday, June 22, 2012 10:59 AM
    Friday, June 22, 2012 10:58 AM