#1 2014-01-03 14:53:41

jeanmarre
Member
Registered: 2013-12-23

Remove special characters from parameters

Hello again !

I would like to know if there is any way to remove special character from report parameters before displaying it to users ?

Thanks in advance.

Jean-Marie

Offline

#2 2014-01-03 17:47:03

Arno Mittelbach
datenwerke
Registered: 2012-02-14

Re: Remove special characters from parameters

Hi Jean-Marie,

I am not quite sure I completely get what you mean. Could you give an example?

Regards
Arno

Offline

#3 2014-01-06 10:39:07

jeanmarre
Member
Registered: 2013-12-23

Re: Remove special characters from parameters

Hello,

I'm a fetching the values for the report parameters with an SQL-Query, but the values sometimes include special characters like html tag

For example : <p>&nbsp;Build for OS W7 and Navigator Chrome</p>

In BIRT Report Design you can choose to display the text with html tag interpretation (using Dynamic Text).

I don't need the interpretation of the tags but the removal of the tag.

Jean-Marie

Offline

#4 2014-01-07 16:35:24

Thorsten J. Krause
Guest

Re: Remove special characters from parameters

Hi Jean-Marie,

you can do this using the post-processing option of the datasource parameter.
If you open the properties of a datasource parameter, under "Specific Properties" you can enter a expression, that transforms your parameter data.

The expression is interpreted as a groovy script and it can access the original parameter values as a two-dimensional array called data. The modified array has to be returned and replaces the original data.

A simple way to strip all tags would be to use

    data*.replaceAll("\\<.*?>","")
   
as a post-processing expression (*. is groovy syntax which applies the function to all elements of the array)

Hope that helps,
Thorsten

Board footer

Powered by FluxBB