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)
Text field based on Value of data column
flatbirt
<p>Hello,</p>
<p> </p>
<p>I'm a little bit confused about what is the best solution, to use java script onprepare or a dynamic text field:</p>
<p> </p>
<p>I need to display a text based on the value of two columns, like</p>
<p> </p>
<div>if (row["EXAMPLE"] == "NULL")</div>
<div>{ 'TEXT1'}</div>
<div>else</div>
<div>{'TEXT2'};</div>
<div> </div>
<div>Is the Syntax right?</div>
<div>How is it possible to check if a row is empty: (== null)?</div>
<div> </div>
<div>Thanks,</div>
<div> </div>
<div>flatbirt</div>
Find more posts tagged with
Comments
micajblock
<p>NULL is not a string so it should be:</p>
<div style="margin:0px;color:rgb(40,40,40);font-family:'Source Sans Pro', sans-serif;">
<pre class="_prettyXprint">
if (row["EXAMPLE"] == null)
{ "TEXT1"}
else
{"TEXT2"};</pre>
</div>
sriram4133
<div style="margin:0px;color:rgb(40,40,40);font-family:'Source Sans Pro', sans-serif;">You can either use double quotes or single quotes to check if it is empty.</div>
<div style="margin:0px;color:rgb(40,40,40);font-family:'Source Sans Pro', sans-serif;"><span>if</span><span> </span><span>(</span><span>row</span><span>[</span><span>"EXAMPLE"</span><span>]</span><span> </span><span>==</span><span> </span><span>null</span><span> || <span>row</span><span>[</span><span>"EXAMPLE"</span><span>] = ""</span>)</span><br><span>{</span><span> </span><span>"TEXT1"</span><span>}</span><br><span>else</span><br><span>{</span><span>"TEXT2"</span><span>};</span></div>