cancel
Showing results for 
Search instead for 
Did you mean: 

Need help to count number of rows and display in file

Former Member
0 Kudos

Hello,

my scenario is IDOC to File......i am using XSLT mapping and using FCC parameters to convert the flat file.

now new requirement is i need to count number of rows and add count value last of the file.

Please let me know how to do it,

thanks in advance for your help.

Regards,

Chinna

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member854360
Active Contributor
0 Kudos

Hi,

see this for an example on Count function in XSLT.

http://www.xsltfunctions.com/xsl/fn_count.html

Shabarish_Nair
Active Contributor
0 Kudos

use the count function in your XSLT mapping itself

http://www.java2s.com/Tutorial/XML/0100__XSLT-stylesheet/Countnode.htm

Former Member
0 Kudos

thanks for the reply.....do i need to create separate field at target side structure to pass the count value into it.

Shabarish_Nair
Active Contributor
0 Kudos

yes. create an additional field. Hence in your FCC you can provide the parameters and get this as part of the output also.

former_member854360
Active Contributor
0 Kudos

Hi,

Yes your target structure should have one field which will contain the Count value.

Former Member
0 Kudos

thanks again, one more Q.

in XSLT mapping i have written for loop for complete structure.

example : <Details>

<node1>

<node2>

</details>

in XSLT mapping

<xsl:for-each select="ZMATMAS_01/IDOC/E1MARAM">

<Details>

</Details>

</xsl:for-each>

if i add the field at target side....then i will come under details node and it will be repeated.

how to declare in XSLT mapping.

Shabarish_Nair
Active Contributor
0 Kudos

ideally it will be better you create a node/field outside of the detail node and then place the value of count for it

former_member854360
Active Contributor
0 Kudos

Hi,

If you are facing problem in modifying the existing XSLT mapping then do one thing.

Creetate another simple one to one graphical Mapping.

add this mapping in operation mapping second position.

in second mapping use the standard Count function and map it to target count field.