Is There Elseif Condition in BODS

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Is there elseif condition in BODS?

My requirement:
If (loopcount =1)
Variable1=value1;
Variable2=value1;
else if(loopcount =2)
Variable1=value2;
Variable2=value2;
else if loopcount =3
Variable1=value3;
Variable2=value3;

How do i script the above in BODS?

It is not entirly clear if you are talking about a mapping or a script function. I assume a script for now.
Code:
If(loopcount=1)
begin
$Variable1=value1;
$Variable2=value1;
end;
elseif(loopcount=2)
begin
$Variable1=value2;
$Variable2=value2;
end;
elseif(loopcount=3)
begin
$Variable1=value3;
$Variable2=value3;
end;

_________________
Werner Daehn

For instance I want to write something like this. if (product = 1 or 2) then (sum(quantity)). what is the
correct syntax.

What worries me a bit is you mixing aggregation functions and scalar functions. Having two queries,
one with the sum(QUANTITY) and the second with an ifthenelse(PRODUCT in (1,2), SUM_QUANTITY,
NULL) is fine.

Or a
sum(ifthenelse(PRODUCT in (1,2), QUANTITY, NULL))
is fine also.
_________________
Werner Daehn

So you are saying that writing something like this is worrisome....


ifthenelse(Query1.PRODUCTGRP in (1,2), sum(Query1.Quantity),NULL)
Your recommendation is that I should create a query where I do sum(quantity) first and then create
another query where I do the ifthenelse and if condition is true then just supply the value from
sum(quantity) but not actually do the sum function in the ifthenelse, am I correct?

You might also like