Thursday, April 14, 2011

BI Publisher: Handling NULL XML Value


There will be three possible scenarios for the value of an element in a XML data, 

1. XML tag value present in the XML data, and it has a value which is not NULL
for ex:
<PO_NUMBER>123</PO_NUMBER>

Suppose you want to give some condition to check not null similar to the one we give in PL/SQL as,
IF value IS NOT NULL THEN
---
---
END IF;
BI Publisher syntax for this is,

<?if:XML_TAG_NAME!=?>
--
--
<?end if?>

    2. XML tag value present in the XML data, but it does not have a value which is NULL.
    for ex:
    <PO_NUMBER></PO_NUMBER>
    (OR)
    <PO_NUMBER/>

    Now you want to give some condition to check null similar to the one we give in PL/SQL as,
    IF value is NULL THEN
    --
    --
    END IF;
    BI Publisher syntax for this is,
    <?if:XML_TAG_NAME and XML_TAG_NAME="?>
    --
    --
    <?end if?>

    3. XML tag is not present in the XML data, and therefore there is no value.
    Now you want to give a condition to check the existence of the tag in the XML data. Here is the BI Publisher syntax for this,
    <?if:not(XML_TAG_NAME)?>
    --
    --
    <?end if?>


    2 comments:

    Mark Wood said...

    Thank you - solved my problem.

    paz said...

    Thanks man! Will try it right now!

    Post a Comment