on 11-13-2013 10:16 AM
Hi experts,
I need to write a UDF function for the following Requirement. Kindly help me in this pls.
My Conterxt Structure will Contain Five Diffrent Context and Each will contain number of context.In target side we are having Five Field.
We need to map the Context value to this Five Fields.
Regard's
Preethi.
Hi Preethi,
Try this,
Pass this queue to collapseContext, then use a UDF...with additional parameter(fieldIndex) as below:
fieldIndex is actually the field number you want to populate. It will be a constant with values 1 to 5... use the same UDF for all 5 fields, Just change fieldIndex from 1 to 5.
int index = Integer.parseInt(fieldIndex[0]);
for (int i=0; i<input.length;i++)
if (index == i+1)
result.addValue(input[i]);
I have just written an un-compiled code but this should work.
Hope it helps!
Ambrish
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Preethi,
This is how I did it (version PI 7.11), not the cleanest but it should give you an idea:
1. Declare variables under attributes and methods:
2. Declare a two UDFs, storeValue and GetValue:
3. Mapping for root:
4. Mapping for row and field1
It does not matter that my source structure is different. What is important is what you are passing to the UDF for storeValue has no context changes and it includes the count per context change. For field2, just change the constant to 2..field3 constant is 3 and so on...
See output:
Hope this helps,
Mark
Hello,
Below is an optimized code in which it takes into account that you will be adding fields in the future:
StoreValue code
GetValue code
Still the same mapping for MT_Target, but for row the counting starts at 0 instead of 1, field2 is 1, field 3 is 2 and so on...
You can only test this mapping in the test tab though. Right-clicking and selecting display queue will not work.
Regards,
Mark
Hi Mark Using this UDF i can achive the first level of mapping for MT in Receiver.
But the Second level for Field and Row is getting a issue. Since My Sender Structure is
MT_TEST
Header
inta
intb
Also in Sender side iam using FCC.Tell me whether in FCC we can design with Record Set Name and Struture
SO that i need to get
MT_TEST
inta
intb
How to achive this in FCC. Help me.
Regard's
Preethi.
Hello Preethi,
The structure I set is just an example. What passes through the UDF I provided is more important. Probably you could design it like this:
Root
-->Header
-----> inputB (0..unbounded)
-->Details
-----> inputA (0..unbounded)
Make sure that in the file, there is a value that distinguishes between header and detail records.
Hope this helps,
Mark
Hi Amrish,
If i am putting Collapse Context before UDF i am getting only the First value of the Context.
But before doing this i need to get the first value of the Five context in One Context nad the Second Value int five contest in Another Context.
Pls kindly help me to do this Experts.
Preethi.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
9 | |
9 | |
6 | |
6 | |
6 | |
5 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.