Oracle Analytics Cloud and Server

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

XML Report differ between tags with the same name

Received Response
152
Views
7
Comments

Summary

XML Report differ between tags with the same name

Content

Hello community,

 

I'm trying to create a PDF report with a XML file in the Word Template. The structure of the XML file ist not optimal but I can't change it.

 

The structure of the XML file is as follows:

<entity>

     <phones>

          <phone>

               ...

          </phone>

          <phone>

               ...

          </phone>

     </phones>

     <director>  

          <phones>

               <phone>

                    ...

               </phone>

          </phones>

     </director>

</entity>

 

Now I want to list all numbers of the entity but not the number of the director. My problem is that this does not work.

I created my repeating groups as follows:

for each entity

     for each phones

          for each phone

               ...

          end

     end

end

 

As the numbers of the director are within the entity tag they appear as well. I need something like:

for each entity

     for the first phones

          for each phone

               ...

          end

     end

end

 

Is there any possibilty to realize that in the word template of the BI Publisher?

 

Thanks

Tagged:

Answers

  • Adam Wickes
    Adam Wickes Rank 6 - Analytics Lead

    Hi,

    I'm a touch confused.
    When you start looping through entity and you begin your "for each phones" loop (ie entity/phones), this shouldn't include the director as the director information is under entity/director/phones. What am I missing?

    Either way, could there be any way you can use wildcard filtering to filter out the unwanted loop? Hard to know without seeing what other data is contained in the XML file.
    If you only want to loop a certain amount of times at a certain level, you can use a variable for this. Set as 0, increment within each loop and have an exit clause.

    Thanks,
    Adam

  • Niclas Wagenknecht
    Niclas Wagenknecht Rank 4 - Community Specialist

    Hello Ron,

    I am familiar with the basic functions of the template builder for word. The point is that the basic repeating group does not work here as I mentioned above. I need to customize the repeating group with some code and I don't know the syntax for it.

    So it would be nice if you could give me a code example exactly for that.

    I'm afraid I'm not allowed to post the RTF or the XML here because it is about a confidential topic.

    Greets

    Niclas

  • Niclas Wagenknecht
    Niclas Wagenknecht Rank 4 - Community Specialist

    Hi Adam,

    the direcor/phones tag is another phones tag that is under entity. That seems to be the reason why the publisher includes it. Whether there are tags in between does not seem to matter.

    Adam Wickes schrieb:
    If you only want to loop a certain amount of times at a certain level, you can use a variable for this. Set as 0, increment within each loop and have an exit clause.

    Thats what I'm looking for but I dont know anything about the code in the publisher template builder. Can u give me a code example for that?

    Thanks a lot

    Niclas

  • Ron-92886
    Ron-92886 Rank 3 - Community Apprentice

    Hello Niclas,

    We can tell you to create a for-each based on the phones and one for the director, but i think it is best to practice and learn first before trying things you are not familiar with.

    Have a look at:
    https://docs.oracle.com/middleware/12211/bip/BIPRD/GUID-25D3CE26-AD11-4A0D-956B-BC2FA5D1E172.htm#BIPRD3404

    http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/bi/bip/tb4word/tbwordbip.htm

    Also use Google. Many sites with good information.

    When you know a bit more, post the RTF and the XML for better support.

    Good luck.

    Greets,

    Ron

  • Adam Wickes
    Adam Wickes Rank 6 - Analytics Lead

    Niclas,

    Have a look at these links.

    Never name it.: XML Publisher -- Can you limit returned rows in a loop ?

    https://blogs.oracle.com/xmlpublisher/wildcard-filtering-continued  --> Applying a filter to your grouping based on one of the fields within that group

    Hopefully they help. If you want to take a look at variables, there's some good info here.

    http://adivaconsulting.com/bi-publisher/item/81-rtf-template-working-with-variables.html

    As Bill mentions, it's a good idea for your own understanding to do some reading. There is plenty of information out there and many different solutions to the one question.
    Is there any way you could provide us the XML and RTF with dummy data?
    I work in a bank so understand the need for privacy but if you modify some sample data for us, that would be helpful.

    Thanks,
    Adam

  • Adam Wickes
    Adam Wickes Rank 6 - Analytics Lead

    Glad to be of help.

  • Niclas Wagenknecht
    Niclas Wagenknecht Rank 4 - Community Specialist

    Hello Adam,

    unfortunately the position() function did not work here. I was able to solve the problem with your third link.

    I used the following code in the opening for-each field:

    /*Working in a loop*/

    <?xdoxslt:set_variable($_XDOCTX, ‘counter’, 0)?>

    <?for-each:G1?>

    /*increment the counter*/

    <?if:xdoxslt:get_variable($_XDOCTX, ‘counter’) = 0?>

    <?xdoxslt:set_variable($_XDOCTX, ‘counter’, xdoxslt:get_variable($_XDOCTX, ‘counter’) + 1)?>

    And in the closing for-each field I added the end of the if clause:

    <?end if?>

    <?end for-each?>

    Thanks for your help

    Niclas