using 'call:' inside 'if' statement — Oracle Analytics

Oracle Analytics Cloud and Server

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

using 'call:' inside 'if' statement

Received Response
51
Views
5
Comments

Summary

using 'call:' inside 'if' statement

Content

I'm having some troubles with the syntax for the code below.  The code is embedded in a field within a .rtf.

I have an alphanumeric that I am doing a 'to_number' in order to do a comparison.  Everything works fine if I use text in the 'then' statement.  The code breaks down when I try using <?call:jack?> rather than text. 

Works:

<?xdofx:if to_number(TOTAL_AMOUNT) > 25000  then 'Higher' end if?>

Does not work:

<?xdofx:if to_number(TOTAL_AMOUNT) > 25000  then <?call:jack?> end if?>

Does anyone have any suggestions about what I am doing wrong?  Any suggestions are appreciated.

Thanks.

Answers

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

    You cannot put nested <? ?> in XML tag.

    The correct syntax is

    <?if: to_number(TOTAL_AMOUNT) > 25000 ?>

    <?call:jack?>

    <?end if?>

  • Kwujcik
    Kwujcik Rank 2 - Community Beginner

    Brajesh,

    Thank you for the suggestion.  I think the to_number is causing the issue here as well.  Without 'xdofx' the code throws an error.  If I add  'xdofx' back in, it appears to ignore the condition and always prints the <?call:jack?> image.

    Any thoughts?

  • Kwujcik
    Kwujcik Rank 2 - Community Beginner

    Thank you for your help.  Unfortunately I am still getting an error.  The modified code is below.  Any thoughts?  It feels like the 'xdofx' and to_number is what is tripping me up...

    <?choose:?>  

    <?xdofx:when: to_number(TOTAL_AMOUNT) > 25000?>   

      <?call:jack?>  

    <?end when?>

    <?end choose?>

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

    Hi ,

    to_number is xdofx function, so its mandatory to use xdofx if we to_number. And also <?call:template?> inside if is not possible because of nested  xml tags (<??>)

    So Please use below xsl code to achieve your requirement.

    1. Create one XML placeholder tag.

    2. Put the below code in the tag

      

        <xsl:if test="number(TOTAL_AMOUNT) > 25000"><xsl:call-template name="jack"> </xsl:call-template></xsl:if>