Oracle Analytics Cloud and Server

Welcome to the Oracle Analytics Community: Please complete your User Profile and upload your Profile Picture

If then else statement for from and to dates

Received Response
92
Views
5
Comments
Rank 4 - Community Specialist

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

Welcome!

It looks like you're new here. Sign in or register to get started.

Answers

  • Rank 7 - Analytics Coach

    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

    https://docs.oracle.com/middleware/12212/bip/BIPRD/GUID-04477E49-F671-4BF1-8353-06A7CDEAD2CC.htm#BIPRD2485

  • Rank 1 - Community Starter

    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?>

  • Rank 8 - Analytics Strategist

    I second this ... do it in the SQL (if possible)

  • Rank 7 - Analytics Coach

    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

  • Rank 5 - Community Champion

    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.

Welcome!

It looks like you're new here. Sign in or register to get started.