on 04-28-2008 10:06 AM
Hi All,
In the Stylus Studio at the target side i have a Recordid, I have to Create a sequential number 1,2,3 for each record which i send from the Sourec side. I have to do it in xslt mapping.
Thanks & Regards
ANIL
Hi,
Use this code inside a UDF and you are done
public String SimpleUserdefined(Container container){
//write your code here
int inc = 1;
Integer seqNum = (Integer) container.getParameter("seqNum");
if (seqNum == null)
{
seqNum = new Integer (inc);
}
else
{
int number = seqNum.intValue() + inc;
seqNum = new Integer (number);
}
container.setParameter("seqNum", seqNum);
return seqNum.toString();
}
Regards
Aashish Sinha
PS : reward points if helpful
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
you can develope this via XSLT mapping with recursive function.
other wise develope an UDF with the following code.
public String seqNumber(Container container)
{
int i;
GlobalContainer global=container.getGlobalContainer();
String getnum=(String)global.getParameter("a");
if(getnum==null){
global.setParameter("a","1"); i=1;
}
else{
i=Integer.parseInt(getnum); i++;
global.setParameter("a",String.valueOf(i));
}
return String.valueOf(i);
}
regards
mahesh.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Why is there a restriction to perform this in XSLT mapping ?
Is this the only mapping you are using ? No graphical mapping ?
If you have any graphical mapping, you can define a global variable which you increment by 1 each time.
Kind regards
Colin.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi ANIL,
as in XSLT (1.) variables and parameter can not be modified if they are onces set, you can only do this through recursion!
See e.g.
Recursion Example 2: Iterating on a number
in
http://www.ibm.com/developerworks/xml/library/x-xslrecur/
Regards Mario
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.