0

I am designing a BIRT report and want to display or hide a text in the BIRT report.

In the property editor, under "Visibility", I have checked the "Hide Element" checkbox and selected the "For All Outputs" radio button.

I am passing the value 1 to the column HIDE. The column HIDE is set as a String in the column mapping. If the value of HIDE is 1, I want to display it else, I want to hide it.

In the expression, I have added the below script

function check(value)
{
    if(value=="1")
    {
    return false;
    }
    else
    {
    return true;
    }
}
check(row["HIDE"])

But the text is always getting hidden and I am not able to find out why. I binded the data the column is returning and I am able to see the value 1 being displayed in the report. Not sure why it is not working in the Expression builder for hiding.

goutam
  • 657
  • 2
  • 13
  • 35
  • Most likely the 1 is converted to an integer for you. Try sending through a word and change your function to look for that word to check if what I'm saying is true or not. I know working with reporting programs that they tend to try and guess the type of inputs and more too often its a PITA when you get to issues like this – user3036342 Jan 23 '15 at 08:29
  • @user3036342 I am not in a position to change the value that the service is returning. Any conversions to string, number conversions nothing seem to work! Any other way for this? – goutam Jan 26 '15 at 06:19
  • Did you try conversions? Weird that it wouldn't work. Is there a way for you to check what value is and what type it is of? Because that would help a lot – user3036342 Jan 26 '15 at 06:55
  • It is stored as 1 (type Number) in a table in an Oracle database. I am binding the value this column is returning in the report and I am able to see the value 1 being displayed. In the column mapping of BIRT, I have saved this as String datatype. There is no problem in displaying this in the report. – goutam Jan 27 '15 at 07:41
  • Did you try f(value==1), because even though your datatype in BIRT mapping is of type String, it might do what I told you these programs usually do, and convert it to an integer automatically since it's a number from Oracle and not a string as declared – user3036342 Jan 27 '15 at 07:53
  • Yeah tried that too. Didn't work. – goutam Jan 28 '15 at 08:10

1 Answers1

1

Look at my answer to this question for a picture. For the compare funtion you select Not Equal to and in the function field you just enter "1". You can leave the field for the value to display blank.

Community
  • 1
  • 1
Simulant
  • 19,190
  • 8
  • 63
  • 98