Oracle Analytics Cloud and Server

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

Setting default values in BI Publisher

Received Response
647
Views
9
Comments
Zimmer
Zimmer Rank 4 - Community Specialist

Summary

Setting default values in BI Publisher

Content

Hi,

 

I am trying this given piece of code in .rtf to set default value of a variable to 3 but it remains blank in .pdf  generated by BI Publisher when the variable value is null. Could this be wrong syntax?

 

<?if:MY_VARIABLE!=''?><?MY_VARIABLE?><? else '3' ?><?end if?>

 

Regards,

Tagged:

Answers

  • Zimmer
    Zimmer Rank 4 - Community Specialist

    Thanks for your help, Venkat-BIP. I changed my code a little in order to format numbers.

    <?if:MY_VARIABLE!= '*'?><?format-number(MY_VARIABLE,'## ##0',’Yen’)?>,-<?end if?> <?if:MY_VARIABLE='*'?><?format-number(5,'## ##0',’Yen’)?>,-<?end if?>

    Here I have '*' as I am using 11g and I am trying to set 5 as default value. But I am still getting the error "Cannot convert to number". could this be because of formatting default value?

  • Youssef_B_82
    Youssef_B_82 Rank 5 - Community Champion

    Hi,

    try if the <?choose:?><?when:element!=""?> statement works  --> try both quotes '' and double cotes ""

    For example:

    <?choose:?>

    <?when:MY_VARIABLE!=""?><?MY_VARIABLE?><?end when?>

    <?otherwise:?>3<?end otherwise?>

    <?end choose?>

    also, if your tag is within a repeating group you might want to add the path

    for example

    <?choose:?>

    <?when:MY_VARIABLE!='""?><?./G_1/MY_VARIABLE?><?end when?>

    <?otherwise:?>3<?end otherwise?>

    <?end choose?>

    Let us know if that works

    Regards,

    Youssef

  • Venkat Thota - BIP
    Venkat Thota - BIP Rank 7 - Analytics Coach

    can you upload xml and rtf template. Thanks

  • Zimmer
    Zimmer Rank 4 - Community Specialist

    It's a number. A double. It's from a data model created as a result of a query.

  • Venkat Thota - BIP
    Venkat Thota - BIP Rank 7 - Analytics Coach

    what exactly my variable is storing ? it is number or varchar. what is the source for myvariable ?

  • Dir_Pal
    Dir_Pal Rank 6 - Analytics Lead

    <?xdofx:if MY_VARIABLE!= '*' then XXXX

    else

    if MY_VARIABLE!= '*' then XXXX

    else

    XXXX

    end if?>

    try using this which might be helpful if u can do it in case.

  • Venkat Thota - BIP
    Venkat Thota - BIP Rank 7 - Analytics Coach

    xdofx:if $FAC!='*' then 'ALL FACILITIES' else $FAC end if ?> ,replace $fac with your variable OR <?xdofx:if $FAC!='' then 'ALL FACILITIES' else $FAC end if

  • Venkat Thota - BIP
    Venkat Thota - BIP Rank 7 - Analytics Coach

    first please check in bip data model how the null value is generating. example in bip 12c null value can be treated as '' in bip 11g it will treat as '*'  , sometimes RTF template wont recognise null as null it will treat as * value. please try with different combinations as '' or '*'.

  • Zimmer
    Zimmer Rank 4 - Community Specialist

    Thanks a lot, Youssef. Using <?choose?> worked. Since MY_VARIABLE is defined beforehand in my data model, how can I set default value for it? For instance:

    <?otherwise:?><?MY_VARIABLE=3?><?end otherwise?>

    something like that?

    Regards,