Categories
If then else statement for from and to dates

Summary
If then else statement for from and to dates
Content
Hi Guru's
I need to build a template that will apply if-then-else statement based upon a the transaction date that lies between a start emp rate date and a end emp rate date. i.e. A record will have a transaction date of 03/07/2017 and it will have an start emp rate date of 01/07/2017 with a end emp rate date of 08/07/2017 and it will have a start job rate date of 14/08/2017 and a end job rate date of 20/08/2017. Based upon this I need to select a value that lies in the emp override rate, when the transaction date falls between emp rates or the job override rate when it falls between the job rate dates otherwise choose the discounted contract rate.
I therefore expect it to select the emp rate.
How do I put this into a if-then-else statement.
Please can you assist.
Thanks
TM
Answers
-
Hi,
if then else is not straight forward in BIP. if-else is xdofx expression in BIP so its uses is limited to some tag or hard coded value...you cannot write any complex expression inside this.
This is if-else
<?xdofx:if element_condition then result1 else result2 end if?>
If its fulfill your requirement you can use it or you can go for when-choose-otherwise which is similar to if-else with limitation
<?choose:?>
<?when:<span class="codeinlineitalic" style="font-style: italic;">expression</span>?>
<?otherwise?>
Below document you can refer for more details with example
0 -
Group
<?for-each-group:row;./BLAHX?><?variable@incontext:G1;current-group()?>
Now add some criteria
<?sum($G1/BLAHY[(../BLAHZ > to_date(../TRANZDATE,'YYYY-MM-DD') and ../BLAHZ < to_date(../TRANZDATE,'YYYY-MM-DD'))])+0?>
Now add more criteria
<?sum($G1/BLAHY[(../BLAHZ > to_date(../TRANZDATE,'YYYY-MM-DD') and ../BLAHZ < to_date(../TRANZDATE,'YYYY-MM-DD'))])
+sum($G1/BLAHA[(../BLAHB > to_date(../TRANZDATE,'YYYY-MM-DD') and ../BLAHB < to_date(../TRANZDATE,'YYYY-MM-DD'))])
+0?>
Now end group
<?end for-each-group?>
0 -
I second this ... do it in the SQL (if possible)
0 -
please let us know the data source for your data model , is this sql Type or any other source , if it is sql query type then create logic directly in sql query and apply in template level , Thanks
0 -
Try handling all complexity at data source level. Keep BIP template just for display purpose only e.g. put IF then else statement in the data source and display the derived value in template.
0