Translation of True/False

Posted by: jatrules07 on 3 August 2017, 3:21 pm EST

  • Posted 3 August 2017, 3:21 pm EST

    Hello
    I have  input values from my XMLprovider as
    field1 is true
    on report it shows as;
      Header                           field1
     My name is changed  :   True
      New name : ABCD
      Reason to change: Reasonabcd

    I want to show Yes or No on the output rather than True or False.
    Also want to hide
    NewName and Reason if field1 value = false and display NO

    Please advice.
    Jess
  • Replied 3 August 2017, 3:21 pm EST

    Sorry I just figured out again that by setting the value of  field in a cell of table or text box like the following

    =iif(Field1.Value = True,"Yes", "No") , always returns, "No", even if I select Yes or No during the runtime.

    I always see "No " as output result, regardless the input that has been provided.

    Please advice.
    Jess
  • Replied 3 August 2017, 3:21 pm EST

    Hello,

    You need not use a hidden column in your table, there is another approach to accomplish the same i.e using the field value as you did above. All you need to do is remove the quotes from True in the if expression, as the XML provider is implicitly converting the True or False to boolean values and you would get the correct results. Please refer to the modified report that depicts the same.

    Hope it will help you. Please let me know if you have any queries further.

    Thanks,
    Manpreet Kaur

    2012/10/YesNoReport1.rdlx
  • Replied 3 August 2017, 3:21 pm EST

    Sorry  I am not able to replicate the same.
    I am not able to have the hidden column added. Can you please provide some way to do that
    Also when I am  passing like =iif(Field9.Value = "True","Yes", "No").
    It is always returning "No" always even if  Field9 = true.

    Please advice.
    Jess
  • Replied 3 August 2017, 3:21 pm EST

    Hello,

    You would need to create an extra hidden column in the table whose field is set to field1 having values True or false and using the same you can alter the text in the column i.e actually displaying the field1.

    And you can change the visibility of the remaining two fields by setting an expression in the visibility property of the textboxes displaying these fields.

    Please have a look at the attached sample report that depicts the same. Hope it will help you. Please let me know if you have any queries further.

    Thanks,
    Manpreet Kaur

    2012/09/YesNoReport.rdlx
  • Replied 3 August 2017, 3:21 pm EST

    Assuming that the data you are retrieving is being pulled up correctly, I have prepared a small and simple test report. That actually takes the True / False value from the parameter. I would like to check if the data you're getting is not in string format, otherwise it may behave the way yours does.

    I hope this helps you

    Thanks,
    -ATalati

    2012/10/Report1.rdlx
  • Replied 3 August 2017, 3:21 pm EST

    Your attached report is working fine.
    But the similiar way does not allows for convertion to the desired input XML value for my report.
    here is similar sample
    as follows:

    Query: //Root/subroot

    Column1     Column2
    Header1        Feild1
    Header2        Feild2
    Header3        Feild3
    Header4        Feild4

    The XML contains
       
           
                   True
                   True
                   False
            

       

      

    But the Output is :
    Column1     Column2
    Header1        Yes
    Header2        Yes
    Header3        Yes
    Header4        Yes

    Desired Output should be

    Column1     Column2
    Header1        Yes
    Header2        Yes
    Header3        No

    The problem is even I provide the values in the properties for the Field(1-4) '  =IIF( ToBoolean(0)=True, "Yes", "No")   '

    The output is always Yes.
    Also It is not filtering the Header4 as the XML does not contain the Header4 , it is not provided at all, but still it shows up with True Value only, i.e; "Yes".

    Do you have some way to handle this situation as my XML can grow or shrink based on the input selection at the runtime, because to handle this I have to write a big chunk of code.

    Thanks
    Jess
  • Replied 3 August 2017, 3:21 pm EST

    Thanks for the response Atalati,

    Well the input I am getting from XML provider is String data.
    So I'm using as:
     number(Field1)
    in the query page of the dataset, still the above value is not returning the correct value as per the input.
    the output comes as
    if i put the expressin as :  =iif(Field1.Value = True,"Yes", "No")
                                               the output is always :  " Yes"

    if i put the expression as :  =iif(Field1.Value = True,"No", "Yes")
                                               the output is always :  " No"

    Also would like to ask as I have a 3 sets of table with 6-7 fields each returning true or false provided by the XML provider.
    How can I handle these?


    Please explain.

    Thanks,
    Jess


  • Replied 3 August 2017, 3:21 pm EST

    I simply copied and pasted the expression that you just gave but mine does say "No"



    Attached is the conerned report.



    HTH
    2012/10/Report1-3.rdlx
  • Replied 3 August 2017, 3:21 pm EST

    It did not worked, any how I modified my code to have it fixed for DBNull values or field that have no information in the  input XML.

    Thanks
    Jess
  • Replied 3 August 2017, 3:21 pm EST

    You meant to say the attached report is not working ?
  • Replied 3 August 2017, 3:21 pm EST

     jatrules07 wrote:
    Thanks for the response Atalati,

    Well the input I am getting from XML provider is String data.
    So I'm using as:
     number(Field1)
    in the query page of the dataset, still the above value is not returning the correct value as per the input.
    the output comes as
    if i put the expressin as :  =iif(Field1.Value = True,"Yes", "No")
                                               the output is always :  " Yes"

    if i put the expression as :  =iif(Field1.Value = True,"No", "Yes")
                                               the output is always :  " No"

    Also would like to ask as I have a 3 sets of table with 6-7 fields each returning true or false provided by the XML provider.
    How can I handle these?



    I think the way you're trying to handle it, might not be correct. I would like you to use the inbuilt capability for String to Boolean conversion. Attached is the modified report...

     jatrules07 wrote:

    Also would like to ask as I have a 3 sets of table with 6-7 fields each returning true or false provided by the XML provider.
    How can I handle these?


    I think you have to do the same for all 6-7. if they would be >10, it would be worth for you to spend some time creating function, but to speed up, I'd suggest you to go to the simple way

    2012/10/TrueFalse.rdlx
  • Replied 3 August 2017, 3:21 pm EST

    yes you can use nested if just like you do, in other environments.



    =iif(Condition1, iif(Condition2,"C1AndC2","C1butC2"),"Neither")
  • Replied 3 August 2017, 3:21 pm EST

    Thanks for this quick response.
    It is working as per the input value, it might be failing for other reason. Because I was trying something similiar to this.
    Or it might be failing because it might be DBNull,
    I want to include(append) the second expression for this for handling DBNull, or null, not null as I stated in other post for  "Handling DBNull".

    Can you please suggest that can I merge both the expressions for Yes/No and the Dbnull for the same field together.


    Thanks
    Jess
  • Replied 3 August 2017, 3:21 pm EST

    .
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels