on 09-19-2012 4:07 PM
Hi,
I have a particular problem. I have an input file that contains groups of records. There should be two records for each vendor. However, some have just one. What I want to do is exclude those vendors that only have one records
INPUT
VENDOR # | TYPE | NAME |
---|---|---|
123456 | A | XXXXX |
123456 | B | YYYYY |
908976 | B | GGGGG |
334567 | A | GGGGG |
334567 | A | GGGFD |
123321 | B | FDSSSS |
OUTPUT
VENDOR # | TYPE | NAME |
---|---|---|
123456 | A | XXXXX |
123456 | B | YYYYY |
334567 | A | GGGGG |
334567 | B | GGGFD |
is there any way this can be done with a simple mapping or do I have to use a UDF
Many thanks
Rob
Hi,
It can be achieved by using XSLT mapping. Please find the below transformation:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:key name="kFieldByVendor" match="Field" use="concat(@name, '+', @displayName)"/>
<xsl:template match= "Field[generate-id()= generate-id(key('kFieldByVendor',concat(@name, '+', @displayName))[2])]">
<xsl:copy-of select="key('kFieldByVendor',concat(@name, '+', @displayName))"/>
</xsl:template> </xsl:stylesheet>
Best Regards,
Sagarika Mishra
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Does anyone have an suggestions on how this can be implemented using XSLT?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I am not sure why do u want xslt for this?? It can be achieved using simple graphical mapping and a 3 line UDF
UDF-> Count
Execution type all values of a context
Input: Var1
int a=var1.length;
if (a>1)
{
for(int i=0;i<2;i++)
result.addValue(var1[i]);
}
Note: Do remember to change the context of all the source field to its Message type name.
Thanks
Amit Srivastava
I dont think you need JAVA / XSLT mapping,using Standard mapping functionality only can be done.
Let me try and come back to you
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
One standard approach is use java mapping or XSLT mapping and remove the single key records.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.