How to hide/unhide data element in report based on user's language in BIRT.

Hi All, My report design has a grid with 6 rows and 2 columns in it. I have all the static text labels on the first column(translated into Different language using resource translation), second column has data item which comes from data source. What i want is the data source has 2 different fields which contains language specific information and other is English data.
For example, I have Name field on the Grid, when a person who runs report in French langugage. His name should be displayed in French. When english language is set. person's English name should appear. I have this information in 2 different fields in data source.

I can get the current language from reportcontext.GetLocale() function, but I don't know how to make the fields visible based on the language parameter.

Am using BIRT version 4.7.0

Any insights will be greatly appreciated.

Answers

  • edited June 8

    You can select an element on the report, go to the Visibility editor, and write an expression that controls when the element displays.

    Note: I didn't test the expression script shown in the screenshot.

    Jeff F.

     

    Customer Support Engineer I

    Website: www.opentext.com

     

    emailsupport-logo-opentext.gif

     

     

     

  • Hey Jeff, I tried to use this expression under visibility of the field which i want to control. But this doesn't hide the field from the Grid. Any ideas what's wrong with this.

    I have tried to run as HTML and also as web viewer but the field doesn't gets hidden.

    If ((reportContext.GetLocale()).value != "fr_FR")
    { true;
    Else
    false;
    }

  • The syntax is a little off. Try this:

    If ((reportContext.GetLocale()).value != "fr_FR")
    { true;
    } else {
    false;
    }

    Jeff F.

     

    Customer Support Engineer I

    Website: www.opentext.com

     

    emailsupport-logo-opentext.gif

     

     

     

  • It gives the syntax error at the else line. Please see attached screenshot.

  • edited June 14

    The I in "if" should be lower case. That's the only issue I see and it could be due to autocorrect.

    Jeff F.

     

    Customer Support Engineer I

    Website: www.opentext.com

     

    emailsupport-logo-opentext.gif

     

     

     

Sign In or Register to comment.