Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Conditional formatting of strings using javascript
Prathibha
Hi,<br />
<br />
When I tried to format a string using javascript functions like bold(), italics() in expression, the html tag for the respective function is getting appended instead of getting the bold or italics data like <strong class='bbc'>data </strong> <br />
<br />
The actual requirement is to 'conditionally format string' or data.<br />
<br />
Kindly help.<br />
<br />
Thanks.
Find more posts tagged with
Comments
mwilliams
Hi Prathibha,
You're doing this in the expression of a data element?
Prathibha
Hi Michael,
Yes, I tried it with expression.
later, I could do this using Text with <VALUE-OF format="HTML">and html tags inside.
Kindly share other ways, if any.
Thanks.
Prathibha
mwilliams
Prathibha,
You can use the following types of expressions in the onCreate method of the script on a data element to change the format.
this.getStyle().fontWeight = "bold";
Hope this helps.
Prathibha
Thanks Michael, This works fine.
mwilliams
No problem. Glad to help.
JoshiS
I receive data in $$ separated array String which are separated further by comma, I want to display them in following fashion <br />
Name : value<br />
Addr : value<br />
City : value<br />
<br />
Name : value<br />
Addr : value<br />
City : value<br />
<br />
For this I am using following expression the columnName is SDR, which may contain N/A or blank values as well <br />
<br />
var myexp =/[$$]/;<br />
var comma =/[,]/;<br />
var match1 =comma.exec(dataSetRow["SDR"]);<br />
var match = myexp.exec(dataSetRow["SDR"]);<br />
if(match !=null)<br />
{<br />
array=dataSetRow["SDR"].split("$$");<br />
var string=null;<br />
for(var i=0; i<array.length; i++)<br />
{<br />
string+=array
+"nn";<br />
}<br />
dataSetRow["SDR"]=string.substring(4,string.length);<br />
}<br />
else<br />
{<br />
if(match1 !=null)<br />
{<br />
array1=dataSetRow["SDR"].split(",");<br />
var string=null;<br />
for(var i=0; i<array1.length; i++)<br />
{<br />
string+=array1
+"nn";<br />
}<br />
dataSetRow["SDR"]=string.substring(4,string.length);<br />
}<br />
<br />
else<br />
{<br />
dataSetRow["SDR"]=dataSetRow["SDR"];<br />
}<br />
}<br />
<br />
Can some one give solution ?
dipanshu07
hi,
i will do that but please provide me xml code or send me report and give some detail.
JoshiS
hi, I am using flat file in PSV i.e. pipe separated data, You may take example of flat file from flat.zip and flatfile.rptdesign as report for your workout
I have used the code for SDR column which divides multiple values separated by $$ . I further want to separate this (comma separated values) into following manner
Name : Vignesh Thambu
Address1 : 354
Address2 : kashish Apartment
Address3 : Vikhroli
Area :
City : Mumbai
State : Maharashtra
Pin
Status : ACTIVE
Date of Activation : 2008-01-01
Date of Deactivation : 2012-01-01
Service Type : ACTIVE