Monday, November 15, 2010

Using The Repeated Region builder

I recently encountered a case where I needed to display some repeating xml data that was embedded in a larger xml structure, something that the data page builder doesn't do well. So I decided to take a look at the repeated region builder, and found out that as with many builders, the correct inputs aren't so easy to figure out.

The data in a variable builder (varData) :
       <descr>Item one</descr>  
       <descr>Item two</descr>  
       <descr>Item three</descr>  

Note that <contact> is a sibling element of <order>, but we're not interested in that. What we want is just a list of orders with the ID hyperlinked to a URL which uses the UPC code as a parameter.

Page builder contents:
   <head><title>Default Test Page</title></head>  
                <tr name="repeatRow">  
                     <td><span name="id"/></td>  
                     <td name="descr"/>  


1234 Item one
3456 Item two
3458 Item three

The repeated region builder is designed to handle this exact scenario, the difficulty comes in defining the correct input values for the builder.

Note that the source data input field points to varData/dsixe/order and not varData/dsixe/order/item. The key piece of information here is the loop variable name (dsixeLoopVar) which is used in other builders to refer to values which are repeated. I think the reason this builder is difficult to use is due to the fact that this variable name doesn't show up as expanded in the variable pickers, it has to be manually typed in.
Also note how the page location repeatRow is a table row and identifies what chunk of HTML will be repeated.

Let's add a text builder to display the descr element:

In this case I was able to select ${Variables/dsixeLoopVar} from the picker and then type /item/descr on the end.

Hope someone finds this useful!
Please note that generic comments containing links with the intent of self promotion will be flagged as spam and deleted.


Are you about to post a generic comment that has nothing to do with this post? Something like "Hey thanks for this very valuable information, BTW here's my website". If so, it will be marked as spam and deleted within 24 hours.

Note: Only a member of this blog may post a comment.