Monday, June 7, 2010

Cross Tab / Column wrapping



Today got a interesting issue/challenge from good friend and colleague Mr. Pinaaki krishnasharma. Issue is if we use a for loop @column and print the rows as column for say Cross Tab reports, the columns that were not able to fit in the page width is going out of the page. See below for example,



And XML file is 



Now we need the column to get wrapped to the next line if there are more columns that cannot be fit in one single row. So the output should look like



So What I did is I introduced an outer loop to and couple of variables to control the number of columns that should print on a single line. And here is my change


V_from and V_to variables were initialized to 0 and 4 before the loops and incremented by 4 (which is fixed columns) inside the loop. On the first loop you must have noticed I have looped 5 times which is hard coded in the loop. This can be made generic by getting the number of rows expected from the XML source itself.

The only issue with the above fix is if there are only 3 columns it will fill with an empty column as column 4. So that it will look something like below.

And here is the code that Mr. Pinaaki krishnasharma helped me with.



You can find these templates and sample XML here. You can also follow Mr. Pinaaki krishnasharma blog here. He will be posting regular tips and notes on various Oracle Apps modules.


No comments:

Post a Comment