on 09-04-2008 11:19 AM
Hi All,
I have 10 records in the same level and in each record there is a field "LineNumber" and this is a incremental field, I have used counter to increment it starting from 1, but in all the cases records the field value is "1", it's not incrementing. I have also tried an UDF, but it also gives the same result.
Do you have any clues????
Regards,
Bharani
Hi,
As is replied earlier the issue is because of the context.
Do paste your source and target structure.
Also try this UDF.
Source(to get the no of occurance) ---> remove context ---> UDF -
> SplitByValue ---> Target
UDF(of type queue):
public void test1(String[] a,ResultList result,Container container)
{
for(int i=1;i<=a.length;i++)
{
String temp = Integer.toString(i);
result.addValue(temp);
}
}
Thanks
SaNv...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Check with the below UDF
use cache parameter value and no inputs to UDF
public String increase(Container container)
{
//write your code here
i = i + 1;
String c;
c = Integer.toString(i);
return c;
}
Here i is a global variable initialized to 0.(goto Edit java section fill in global variable section and initialization section)
increase--->target
Edited by: malini balasubramaniam on Sep 4, 2008 3:12 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Is the counter increment value is 1.
The problem might be because of the context level.
Can you paste the source and target structure that is used.
Thanks
SaNv...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey use this,
int inc=1;
Integer seqno=(Integer) container.getParameter("seqno");
if(seqno==null)
{
seqno = new Integer(1);
}
else
{
int number=seqno.intValue()+inc;
seqno=new Integer(number);
}
container.setParameter("seqno",seqno);
return seqno.toString();
thanks
hemant
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Prakasu,
But the counter is not related to any of the source field....
I have records...based on certain conditions records are populated
Record 1
-
counter -> LineNumberField
Record 2
-
counter -> LineNumberField
Record 3
-
counter -> LineNumberField
Record 4
-
counter -> LineNumberField
So I don't have the scope of changing the context anywhere.
Regards,
Bharani
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
that time you can choose the option static function "index".Select in the properties Initial value '1', Increment '1' and count indices "Entire Document".
Record 1
-
Index -> LineNumberField
Record 2
-
Index-> LineNumberField
Record 3
-
Index -> LineNumberField
Record 4
-
Index -> LineNumberField
This will work for ur requirement.
Regards,
Prakasu
Hi Bharani,
Instead of using a counter, you can use the Statistic Function called Index. It can also be manipulated to count contexts.
Hope this helps.
Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Using counter we can achive your requirement.Its because of context problem.
Change the context parent node..
Like,
you have a structure,
<Node>
<Node1>
<Field>
Then change the context to Node.
Regards,
Prakasu
Edited by: prakasu on Sep 4, 2008 12:24 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
7 | |
7 | |
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.