on 03-09-2012 5:16 AM
Hi All,
I have a scneario where in the target structure looks like following.
StoreService is a node and SequenceNbr is a field.
Whenever the node StoreService is created, the SequenceNbr should be generated like 1,2,3 and so on..
Header
StoreService 0..1
SequenceNbr 1..1
StoreService 0..1
SequenceNbr 1..1
StoreService 0..1
SequenceNbr 1..1
StoreService 0..1
SequenceNbr 1..1
I have written a UDF with global variable that takes care of the SequenceNbr generation.
It is working fine for 5-6 StoreService.
And after that the SequenceNbr are getting random values.
Please provide your pointers.
Regards,
Rashi
Hello,
StoreService is a node and SequenceNbr is a field.
What is your logic in generating the store service? Can you just use index e.g
Logic for generating StoreService -> index: 1,1 -> splitByValue:eachValue -> SequenceNbr
Regards,
Mark
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The Header node is repeating itself.
So for the output should look as below
Header
StoreService
SequenceNbr 1
StoreService
SequenceNbr 2
StoreService
SequenceNbr 3
Header
StoreService
SequenceNbr 1
StoreService
SequenceNbr 2
StoreService
SequenceNbr 3
StoreService
SequenceNbr 4
Header
StoreService
SequenceNbr 1
StoreService
SequenceNbr 2
and so on..
Hello,
Header
StoreService
SequenceNbr 1
StoreService
SequenceNbr 2
StoreService
SequenceNbr 3
Header
StoreService
SequenceNbr 1
StoreService
SequenceNbr 2
StoreService
SequenceNbr 3
StoreService
SequenceNbr 4
I'm guessing the context change to generate store service will look like this
storeservice
storeservice
storeservice
CC
storeservice
storeservice
storeservice
storeservice
Then you can use index, in the properties though, specify to restart indexing per context change. The mapping will remain the same
source -> index:1,1 -> splitByValue:eachValue -> SequenceNbr
Hope this helps,
Mark
write one more UDF which basically resets the counter/sequence number to 0 whenever it creates Header node.
Object obj = container.getParameter("SeqNo");
Integer i;
if (obj == null)
i = new Integer(0);
else
i = (Integer) obj;
container.setParameter("SeqNo", i)
return ""; //return a; where a is input from source to create enough header contexts
Hi Praveen,
I had used the following approach.
1.) Declared the global variable 'inp' in Attributes & Methods.
2.) UDF 'Initialization' to reset the value 'inp' to 0 for every new Header being created.
inp = 0;
return "";
3.) UDF 'IncrementIndex' to increment the value of 'inp' for every new StoreService to be assigned to SeqNbr.
inp++;
return Integer.toString(inp);
The above UDF gave the correct output uptil 5-6 StoreService. But after that, it is generating random no.s.
Can you please explain where am I going wrong with this approach?
Regards,
Rashi
try with this sample code,
Object obj = container.getParameter("SeqNo");
Integer i;
if (obj == null)
i = new Integer(0);
else
i = (Integer) obj;
i = new Integer(i.intValue() + 1)
container.setParameter("SeqNo", i)
return i.toString();
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
23 | |
11 | |
9 | |
9 | |
5 | |
5 | |
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.