Multi Column Row Woes

Through streaming eyes and a nose that wont stop running, its a doozy of a cold/flu. I found a nice question yesterday on the forum from Chris (chrish6):

Hi All

I have just spent the last couple of hours trying to do something which I was hoping would be fairly simple - the only thing I have figured out is that it is not simple.

Heres my problem, I have data structured like so


I want the data to come out in RTF data like this

Chris One Chris Two
Chris Three Chris Four

I really want to avoid changing the data file.
So I don't come across as a lazy boy I have looked into a couple of things....
Tims blog on Rows and Columns - this is the direction I need to go but I don't get how to force a new line - I tried it and got all records on one line.
I've read various forum posts a blog by another guy doing invoice stuff - which seems over complicated for what I need.
Tim - any chance you could do a follow up to your rows and columns blog??
I'm running latest BIP,
my data can have x amount of records and may be an odd or even amount of records.

Not sure on the horse reference, maybe Chris has a race horse stable and wants to generate address labels for them. I came up with a solution that requires you to specify the number of columns you want in the table. In Chris' case its 2, it relies on a small piece of XPATH code to get specific records or horses to show up.

All we have in the template is a 2 celled table, inside each we have a complete for-each loop with the HORSE_NAME and an end loop.


The contents of the F fields are :

<?for-each:HORSE[position() mod 2=1]?>   -   <?for-each:HORSE[position() mod 2=0]?>

the [position() mod 2 =1] expression tests the result of dividing the current record number by two and check the remainder. This puts the odd records into the first column and even records into the second column.


Now your not tied to two columns, just add a column and adjust the 'mod' calculation to have

<?for-each:HORSE[position() mod 3=1]?> 
- <?for-each:HORSE[position() mod 3=2]?> 
- <?for-each:HORSE[position() mod 3=0]?>

to get this output


Sample template and data here.
You can keep going as long as you wish, just need to work out the 'mod' calcs and of course if you dont want horses but maybe address labels, just add the fields you need and you're 'off the races' as it were.


Yup, couldn't agree more. And I'd like to add that you've got a great colour scheme on your site, I suffer with colour blindness and many webmasters don't give us a second thought!

Posted by Cortaflex on January 03, 2010 at 11:34 PM MST #

Who knows where can I download desktop virtual girls from here - VirtuagirlHD for free?? Is it possible? I've heard it is.

Posted by JackSheppardio on February 10, 2010 at 02:28 AM MST #

We planned to have a debate going about this subject. Can anyone broaden on the topic you actually authored about the following?

Posted by wrinkle removal on February 23, 2010 at 04:07 AM MST #

Im excited, about the London Olympics I know it will help bring money in to London, but things are getting far too expensive here now

Posted by London Sweep on April 20, 2010 at 12:09 AM MDT #

I saw this earlier, very interesting: Filly set to race in Kentucky Derby: Owner John Greathouse will enter the 3-year-old filly in the Run for the Roses, one of four shots the Eclipse Award-winning trainer has at ending his 0-for-24 Derby hex. Devil May Care won the Frizette at Belmont last fall and is coming off a solid victory in the Bonnie Miss at Gulfstream Park on March 20.

Posted by Main St Marketing Machines on April 27, 2010 at 05:33 AM MDT #

Very good article! I would like to thank you for the efforts you have made in writing this article. I am hoping the same best work from you in the tomorrow as well. In fact your creative writing ability has inspired me to start my own BlogEngine blog now. Really the blogging is spreading its wings rapidly. Your write up is a fine example of it.This is to be honest a Great knowledge gaining post and all thanks to google search engine get me on here. I loved reading your writing and added to the favorites.Thanks again!

Posted by what is the survival rate for liver cancer on August 08, 2010 at 03:01 AM MDT #

Post a Comment:
  • HTML Syntax: NOT allowed

Follow bipublisher on Twitter Find Us on Facebook BI Publisher Youtube ChannelDiscussion Forum

Join our BI Publisher community to get the most and keep updated with the latest news, How-to, Solutions! Share your feedback and let us hear your voice @bipublisher on Twitter, on our official Facebook page, and Youtube!


« June 2016