Jump to content

BIRT Developer Center Download


Photo
- - - - -

expression issue

expression script convert

  • Please log in to reply
2 replies to this topic

#1 hatraatrin

hatraatrin

    Advanced Member

  • Members
  • PipPipPip
  • 68 posts

Posted 12 September 2017 - 02:24 AM

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

 

 

 

 



#2 Clement Wong

Clement Wong

    Senior Member

  • BIRT Experts
  • 1204 posts

Posted 12 September 2017 - 01:23 PM

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


#3 hatraatrin

hatraatrin

    Advanced Member

  • Members
  • PipPipPip
  • 68 posts

Posted 13 September 2017 - 01:20 AM

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







Also tagged with one or more of these keywords: expression, script, convert