BIRT Conditional aggregate in an expression
Options
<p>Hi -</p>
<p> </p>
<p>I'm new to BIRT and I'm trying to build an aggrigate based on a condition. I've got the following Fields:</p>
<p> </p>
<p>PLAN1</p>
<p>PLAN1_VALUE</p>
<p>PLAN2</p>
<p>PLAN2_VALUE</p>
<p>PLAN3</p>
<p>PLAN3_VALUE</p>
<p> </p>
<p>I need to write a condition as follows:</p>
<p> </p>
<p>If PLAN1 = 'SALES' then PLAN1_VALUE ELSE 0 END IF;</p>
<p>+</p>
<p>If PLAN2 = 'SALES' then PLAN2_VALUE ELSE 0 END IF;</p>
<p>+</p>
<p>If PLAN3 = 'SALES' then PLAN3_VALUE ELSE 0 END IF;</p>
<p>+</p>
<p>If PLAN4 = 'SALES' then PLAN4_VALUE ELSE 0 END IF;</p>
<p> </p>
<p>I'm getting an error when trying to write the expression. I'm new to javascript </p>
<p>I can get the one condition to work, but I'm running into a problem with adding them together.</p>
<p> </p>
<p><b>if</b> (dataSetRow["PLAN1"] = 'Sales' ){</p>
<p>dataSetRow["PLAN1_VALUE"];</p>
<p>}</p>
<p><b>else</b> {</p>
<p>0;</p>
<p>}</p>
<p>+</p>
<p><b>if</b> (dataSetRow["PLAN12] = 'Sales' ){</p>
<p>dataSetRow["PLAN2_VALUE"];</p>
<p>}</p>
<p><b>else</b> {</p>
<p>0;</p>
<p>}</p>
<p> </p>
<p>You're help would be greatly appreciated!</p>
<p>+</p>
<p><b>if</b> (dataSetRow["PLAN3"] = 'Sales' ){</p>
<p>dataSetRow["PLAN3_VALUE"];</p>
<p>}</p>
<p><b>else</b> {</p>
<p>0;</p>
<p>}</p>
<p> </p>
<p>I'm new to BIRT and I'm trying to build an aggrigate based on a condition. I've got the following Fields:</p>
<p> </p>
<p>PLAN1</p>
<p>PLAN1_VALUE</p>
<p>PLAN2</p>
<p>PLAN2_VALUE</p>
<p>PLAN3</p>
<p>PLAN3_VALUE</p>
<p> </p>
<p>I need to write a condition as follows:</p>
<p> </p>
<p>If PLAN1 = 'SALES' then PLAN1_VALUE ELSE 0 END IF;</p>
<p>+</p>
<p>If PLAN2 = 'SALES' then PLAN2_VALUE ELSE 0 END IF;</p>
<p>+</p>
<p>If PLAN3 = 'SALES' then PLAN3_VALUE ELSE 0 END IF;</p>
<p>+</p>
<p>If PLAN4 = 'SALES' then PLAN4_VALUE ELSE 0 END IF;</p>
<p> </p>
<p>I'm getting an error when trying to write the expression. I'm new to javascript </p>
<p>I can get the one condition to work, but I'm running into a problem with adding them together.</p>
<p> </p>
<p><b>if</b> (dataSetRow["PLAN1"] = 'Sales' ){</p>
<p>dataSetRow["PLAN1_VALUE"];</p>
<p>}</p>
<p><b>else</b> {</p>
<p>0;</p>
<p>}</p>
<p>+</p>
<p><b>if</b> (dataSetRow["PLAN12] = 'Sales' ){</p>
<p>dataSetRow["PLAN2_VALUE"];</p>
<p>}</p>
<p><b>else</b> {</p>
<p>0;</p>
<p>}</p>
<p> </p>
<p>You're help would be greatly appreciated!</p>
<p>+</p>
<p><b>if</b> (dataSetRow["PLAN3"] = 'Sales' ){</p>
<p>dataSetRow["PLAN3_VALUE"];</p>
<p>}</p>
<p><b>else</b> {</p>
<p>0;</p>
<p>}</p>
0
Comments
-
<p>If you copied/pasted your javascript, there's an error in your PLAN2 section:</p>
<pre class="_prettyXprint">
if (dataSetRow["PLAN12] = 'Sales' ){
</pre>
<p>I'm guessing you wanted that to say:</p>
<pre class="_prettyXprint _lang-">
if (dataSetRow["PLAN2] = 'Sales' ){
</pre>0
Categories
- All Categories
- 109 Developer Announcements
- 49 Articles
- 100 General Questions
- 122 IM Services
- 40 OpenText Hackathon
- 31 Developer Tools
- 20.6K Analytics
- 4.1K AppWorks
- 8.9K Extended ECM
- 897 Cloud Fax and Notifications
- 77 Digital Asset Management
- 9.3K Documentum
- 29 eDOCS
- 122 Exstream
- 39.8K TeamSite
- 1.7K Web Experience Management