expression issue

hi Experts,


I have this  script on my older version of a reporting tool :


 


 


whileprintingtrcords;


stringvar sd;


if { function} like "qw" then bb := "quality work"


else


if {funcrion} like "bd" the bb := "bad door"


else


if {function} like "ny" the bb := "not yellow"


else


{function}


 


and I want to use the same logic on BIRT Expression, I used the exact syntax but it gives me error and I also try to modify but it seems like I am doing something wrong the {function} filed in my design called


row["function"]


I appreciate any help advise


thanks


 


 


 


 


Comments

  • In your script from the other reporting tool, it appears that you just trying to change the value from one to another.


     


    In BIRT's scripting, you will be using JavaScript.  To change the final value in BIRT, you have many options to do this:


     


    1. Created a Computed Column of String data type at the Data Set level.  You can use if..then...else, or a switch statement.


     


    For example:



    if (row["function"] == 'qw')
    'quality work';
    else if (row["function"] == 'bd')
    'bad door';
    else if (row["function"] == 'ny')
    'not yellow';
    else 'unknown';

    2. Create a "Map" at the Data item level.


       A. Select the data report item in the Layout


       B. Select "Property Editor - Data" in the lower right pane


       C. Click on the "Map" tab


     


    From there you can click on "Add..." to define say "Value of this item" "Equal to" "dw".  Then display following value: quality work.


     


     


    There are other options, but these two are the easiest to understand and implement.

    Clement Wong
    Principal Analytics Architect

    OpenText Corporation
    http://www.actuate.com | http://www.opentext.com

  • thanks Clement option one is what I needed, I am just not good at JavaScript :(


Sign In or Register to comment.