AND Not working inside if statement in BI Publisher template — Oracle Analytics

Oracle Analytics Cloud and Server

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

AND Not working inside if statement in BI Publisher template

Received Response
382
Views
7
Comments

Summary

AND Not working inside if statement in BI Publisher template

Content

Hi Experts,

Below expression error out when sample xml was loaded into RTF template on word and trying to generate PDF. "BookingMRC" and "TotalMRC" and xml tag in the sample xml.

Not working:

<?if:BookingMRC != '' AND TotalMRC != '' AND TotalMRC > 0 AND BookingMRC < 0?>

Increase%: <?xdoxslt:round((((-BookingMRC) div TotalMRC)*100),2)?> %

<?end if?>

Working:

<?if:BookingMRC != ''?><?if:TotalMRC != ''?><?if:TotalMRC > 0?><?if: BookingMRC < 0?>

Increase%: <?xdoxslt:round((((-BookingMRC) div TotalMRC)*100),2)?> %

<?end if?><?end if?><?end if?><?end if?>

Why not working with first approach?

Thanks,

Vinay

Answers

  • Vinay Ramu
    Vinay Ramu Rank 2 - Community Beginner

    Additional info on "Not working" scenario. The error happens when TotalMRC is Null in XML.

    for e.g.,<TotalMRC/>

    Thanks

  • Brajesh Shukla-95078
    Brajesh Shukla-95078 Rank 7 - Analytics Coach

    Nope...I put 'and' in small case....XML publisher will not accept upper case 'AND'.

  • Brajesh Shukla-95078
    Brajesh Shukla-95078 Rank 7 - Analytics Coach

    <?if:BookingMRC != '' and TotalMRC != '' and TotalMRC > 0 and BookingMRC < 0?>

    Increase%: <?xdoxslt:round((((-BookingMRC) div TotalMRC)*100),2)?> %

    <?end if?>

    Can you try the above?

  • Jim Mcdonald
    Jim Mcdonald Rank 3 - Community Apprentice

    Are you using this to hide or display a field? If so, the <?choose"> statement works well for this and the <?when:?> can contain xdoxslt.

  • Sherry George
    Sherry George Rank 7 - Analytics Coach

    What is the error? this should work. If you can, please post a sample XML to test.

  • Pavan kumar.
    Pavan kumar. Rank 5 - Community Champion

    Hi,

    Because BI Publisher has extended set of SQL and XSL functions in RTF Templates.

    Whereas we cannot not use mix them within one expression as suggested by the oracle team.

    As you mentioned in the first expression with AND Operand is belongs to SQL and whereas you are using it in XSL expression.

    It's one of the primary reason the expression is not working as expected

    Regards

    Pavan

  • Vinay Ramu
    Vinay Ramu Rank 2 - Community Beginner

    Hi Expert,

    Thanks for your reply. I have marked case sensitive "and" as correct answer as that worked out for me.

    -Vinay