An Oracle blog about BI Publisher

  • RTF
    July 1, 2009

First Last & Always

Been reminiscing about music from my youth, a boy of the eighties there was so much going on back then. I was into some weird stuff Gene Loves Jezebel, the Boot Hill Foottappers, the list goes on, I was also into the Sisters of Mercy where the title for this post comes from. Im nothing if not consistent with my tenuous blog titles.

Quick question on an internal forum asking how to show just the first and last record in a group. XPATH to the rescue there are a couple of functions we can use to fetch just the first and last record. Lets assume we are looping over EMPLOYEES.


this will fetch all records. With the addition of the XPATH expression

<?for-each:EMPLOYEES[position()='1' or position()=last()]?>

The XPATH standard allows us to create a filter, if or boolean expression to limit the number of rows to be rendered.

position() - returns the current record being process. So position() = 1 will only return the first record

last() - returns the last record pointer. So position()=last() will give us the last record only.

Combining them together with an 'or' statement ensures we only get the first and last record in our group. Done!

Join the discussion

Comments ( 3 )
  • Drew Peterson Tuesday, January 12, 2010

    Do you think it's advisable to bring roses on a first date?  I met a girl who's just amazing, hot, cool, great body, etc.  I'm taking her to dinner and drinks, and I'm hoping for dessert at my place.


    In Love

  • RS Wednesday, May 26, 2010
    How do you set 'current record only' functionality in new BIP reports? I am aware that the latest fixpack for Siebel should fix the issue. But, is there a code or functions that would help to achieve this functionality without installing the fix pack?
  • Vasiliy Tuesday, May 17, 2011
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.