This discussion is archived
2 Replies Latest reply: Aug 5, 2013 9:39 AM by Venugram RSS

If employee id is the same should not print on the xml publisher report

777372 Newbie
Currently Being Moderated
Hi Dear,

I met with one problem and needs some suggestion on the best approach on it. It is a xml publisher report.
We have multiple rows for the same employee , but for the same employee only the first row needs to print the emplid.
Do we need to write the if statement , how to get the value of the last row emplid ?

For example :
EMPLID EMP_RCD STATE
1001 0 CA
1 TX


Any suggestion is appreciated.

Thanks,

Dennis
  • 1. Re: If employee id is the same should not print on the xml publisher report
    RahulB Newbie
    Currently Being Moderated
    I understand your requirement is as follows:

    Requirement:_

    The data is this ->

    EMPLID COLUMN 1 COLUMN 2 COLUMN 3

    EMPLID_01 DATA_01_01 DATA_02_01 DATA_03_01
    EMPLID_01 DATA_01_02 DATA_02_02 DATA_03_02
    EMPLID_01 DATA_01_03 DATA_02_03 DATA_03_03
    EMPLID_02 DATA_01_04 DATA_02_04 DATA_03_04

    And you need report in this format:

    EMPLID_01 DATA_01_01 DATA_02_01 DATA_03_01
    DATA_01_02 DATA_02_02 DATA_03_02
    DATA_01_03 DATA_02_03 DATA_03_03

    EMPLID_02 DATA_01_03 DATA_02_04 DATA_03_04


    Solution:_
    If my understanding is correct, then you can make use of variables

    at start of template set the variable to 0
    *<?xdoxslt:set_variable($_XDOCTX,'PREV_EMPLID',0)?>*

    at the end of each data row, reset the variable
    *<?xdoxslt:set_variable($_XDOCTX,'PREV_EMPLID',EMPLID)?>*

    while printing emplid in that row use IF condition
    *<?if:(xdoxslt:get_variable($_XDOCTX, 'PREV_EMPLID'))!=EMPLID?>*
    The above If condition will print emplid on the row only when there is change in EMPLID, so effectively printing emplid only on the 1st row of data for each employee id.
    Also, you need to ensure that you group by employee id before you print each row.

    Let me know if this works for you.
  • 2. Re: If employee id is the same should not print on the xml publisher report
    Venugram Newbie
    Currently Being Moderated

    Hi,

     

    If your requirement adheres to that explained by RahulB, you can try using the following form field for the EMPLID value:

     

    <?EMPLID[not(.=preceding::EMPLID)]?>

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points