X

An Oracle blog about BI Publisher

  • RTF
    November 13, 2008

Star Power!

I have covered our MSWord shape support in various entries and there are some examples in the documentation. As you know we can change the shapes by skewing them, stretching them, squashing them, etc. We can also repeat them - the last is useful, if say, you want a visual representation of a rating for an employee.

Star1.jpg

As I mentioned, this can be achieved with shapes and that is documented, Jen (who watches our TARs/bugs among other fabulous activities) sent me a variation on the shape repeating. Gif repeating! The customer wanted to use an embedded image rather than a shape and have that repeat - it was a star gif which begged the question 'why not use a shape?' but anyhoo, we aim to please with BIP so here goes.

Some of you that have repeated shapes will be familiar with something like:

<?for-each@shape:xdoxslt:foreach_number($_XDOCTX,0,RATING,1)?>

This code is embedded in the shape to get it to repeat, we want to repeat an embedded image so we can not embed the code, we have to wrap it, so we get some thing like this:

Star2.jpg

A little different, but it generates the correct number of stars. You need to remove the @shape and use the @inlines to get them on a single row and then have the loop start at 1. Remember with shapes you can eliminate the star in the template with the offset but with the gif approach you cant so when RATING =1 we only want a single star so the loop needs to run from '1 to 1' to just get a single star, For rating =3 we get from 1 to 3 ie it adds two more stars to the row. If there is a situation where there should not be an image you will have to get imaginative and wrap an if around the whole thing so that nothing is shown.

If you are interested in the template, you can get it here.

Now people, I covered stars, what other images might you want to repeat on a report, I want business requirements here!

Join the discussion

Comments ( 3 )
  • Martand Joshi Friday, January 30, 2009
    Hi
    I have to create a report with page border. When I give the page border in template, it is not coming while generating report or while doing preview. The output would be PDF.
    Request you to help me how to do this.
    Can I use shape i.e. Square Box or something for this requirement ? if yes, how ?
    Regards,
    Martand Joshi
  • pallavi Monday, June 28, 2010
    i dont hav any column as rating which includes numeric value.i cant use the formula given above.i hav a colum of revenue in my database.
    i want stars in a new column as if
    revenue>5000 stars shud come in dat correspondin column.
    revenue >10000 then 4 stars shud come.like this...
    how can i use stars now.
  • garima Monday, June 28, 2010
    I hv a table. I hv a field revenue in dat table I want stars in a new column according to the condition such as
    if revenue<10000 then 3 stars shud come
    if revenue is in between 10000 and 20000 then 4 stars shud come in dat particular column.
    The above formula is not working.
    What shud I do now???
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.