Oracle Analytics Cloud and Server

Products Banner

Setting default values in BI Publisher

Received Response
496
Views
9
Comments

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

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

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

    can you upload xml and rtf template. Thanks

  • Zimmer
    Zimmer ✭✭✭

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

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

  • Dir_Pal
    Dir_Pal ✭✭✭✭✭

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

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

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

    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,