on 09-10-2015 1:23 PM
Hi,
I am taking in a value from a file and I need to use it in multiple segments and in each segment it has to be the number in incremental steps...there can be just 2 of 3 segments or up to 50
So I have created a global variable and assigned the number to it.
My problem is how to then increase it.
I created a UDF and added a cntr as a public int. I am also then passing in the global variable...what I would like is to simply and the counter (initially 1) to the variable and pass the result back out....so 500 + 1 becomes 501
I then add 1 to the cntr so the next time it comes into the function it will be 500 plus 2 and counter increased again and so on and so on.
However I am getting mismatches between intergers and arrays and cannot get it to work.
Any help greatly appreciated
B
<source>
<value>500</value>
</source>
<Target>
<node>500 </node>
<node>501 </node>
<node> 502</node>
<node> 503</node>
<node>504 </node>
<node> 505</node>
<node> 506</node>
</Target>
If this is what you want
1)In Attributes and methods declare a int variable cntr = 0;(you have already done that.
int cntr = 0;
2)create udf "initial_value" with the code below to initialize the counter to 500 (value)
(execution type : all values of a context, argument name value, take a result output)
{
cntr = Integer.parseInt(value[0]);
result.addValue("");
}
map the udf from source node to target node
Source--->initial_value--->Target
3)Based on which node(base) /field from source you are generating these multiple nodes on target....
write a udf counter
(all values of context, arguments item, output as result)
i assume that you have as many base nodes
base--->splitbyeachvalue-->udf counter--->remove context-->node
udf code
{
result.addValue(""+cntr);
cntr++;
}
Regards
Vinay
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
81 | |
10 | |
10 | |
9 | |
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.