Page Separator and Counter

Leo_Lacuna
edited February 11, 2022 in Analytics #1

I am currently using Workday Studio (BIRT) where I am extracting sample data Workday as xml to build a report and deploy it back to Workday. My requirement is to print details of individual employee for several locations and after each location, I need to add a page separator which displays detail of the location which it printed and how many employees (more like a counter) before I jumps to employee of next location and then another page separator with location and how many employees were printed.
I am partially successful. Couple of issues are that I am not able to get the last page separator.

I've created a field that identifies the previous row value for location and I am comparing that value with the current row location and I've inserted a row that I display for page separator with a page break. As it hits the last row and I do not have any more value to compare it against, the last page separator never displays.

Best Answers

  • Chad Montgomery
    edited April 6, 2018 #2 Answer ✓

    This is achievable without custom code. Attached is a report I whipped up.
    Ignore the script for the data set, I just used a scripted one so that I didn't need to worry about an external source of data.

    The table is grouped on Location, and has a grid for each section.
    The Employee grid is in the detail row, and displays like normal.
    The Location grid is in the group footer row of the table and has an aggregation to count number of employees per location.
    Lastly, I have page break after set to always for both the detail and group footer row.

    Warning No formatter is installed for the format ipb
  • That's just how you have to do it when using a scripted data set. It's nothing to worry about if you aren't using a scripted data set.

    Warning No formatter is installed for the format ipb
  • jfranken
    #4 Answer ✓

    Drag an Aggregation element into the empty cell. In the Aggregation editor, set the Function to "First", set Expression to the ID column, and click the radio button to aggregate on the group.

    Warning No formatter is installed for the format ipb

Answers

  • We've noticed this question is over 30 days old and hasn't received a response. Were you able to resolve the issue, or would you like some assistance? Your question and its resolution are important to us, and we want to help.

    We have marked your question assumed “Accepted Answered.” However, please note that marking the question answered in this case is only an accounting process for every post in the forums. The question remains open to answers, additional questions, or other posts.

    David Sciuto

  • Hi David, my questions has not been answered yet and still looking for any help.

  • Could you provide your design, or an example that demonstrates what issue you're stuck on?

    Warning No formatter is installed for the format ipb
  • Hi Chad, attached is an excel sheet with the raw data and the output I want to achieve.
    I used a page break on each employee. I want to have one page per employee and add a page separator after each location that displays the location which it just printed and how many employee page were printed (Page / employee counter).

    I first created a field to capture the previous location (PreviousLocation):

    var lastLocationToReturn = 'FirstLocation';
    if (reportContext.getGlobalVariable("lastLocationValue") != null)
    {
    lastLocationToReturn = reportContext.getGlobalVariable("lastLocationValue");
    }
    reportContext.setGlobalVariable("lastLocationValue", dataSetRow["Location"]);

    This will give me the previous location.
    I added
    var rowCounterByLoc = 1;
    var incrementGroupCounter = 1; in report initialize

    I then wrote a script on onPageBreak event of the table:

    if (row["Location"] == row["PreviousLocation"] || row["PreviousLocation"] == null)
    {
    incrementGroupCounter = rowCounterByLoc++;
    }
    else
    {
    rowCounterByLoc = 1;
    }

    This counts and works fine when there are more than one employee per location, if there is only one employee, it displays the page counter which was printed for the previous location. And the last page break (or page separator) never gets printed as it doesn't have any other location to compare against.

  • Chad Montgomery
    edited April 6, 2018 #9 Answer ✓

    This is achievable without custom code. Attached is a report I whipped up.
    Ignore the script for the data set, I just used a scripted one so that I didn't need to worry about an external source of data.

    The table is grouped on Location, and has a grid for each section.
    The Employee grid is in the detail row, and displays like normal.
    The Location grid is in the group footer row of the table and has an aggregation to count number of employees per location.
    Lastly, I have page break after set to always for both the detail and group footer row.

    Warning No formatter is installed for the format ipb
  • Hi Chad, thank you very much for the sample design. I see you written a script onFetch to check if the length of the data is greater than count (cnt). However, as I am fetching the data or rather I will be deploying to this design to workday and I am not aware of the length of the data that is being generated. Will this code work?

  • That's just how you have to do it when using a scripted data set. It's nothing to worry about if you aren't using a scripted data set.

    Warning No formatter is installed for the format ipb
  • Leo_Lacuna
    edited April 11, 2018 #12

    Hi Chad, I implemented this and works great. Thank you very much. I have one last query related to this. With the way I had coded earlier, I was keeping a track of when the location changes and along with printing the Employee count, I was also printing the First and Last Employee on the page separator. I see I can easily add the ID which would always show the last ID that was printed. How can I get the first ID which was printed for that Location.
    Attached is the updated sample from your original design Chad.

  • jfranken
    #13 Answer ✓

    Drag an Aggregation element into the empty cell. In the Aggregation editor, set the Function to "First", set Expression to the ID column, and click the radio button to aggregate on the group.

    Warning No formatter is installed for the format ipb