on 12-07-2015 3:32 PM
Hi Experts
My source structure is
<Message> 1-1
<METER> 0-unbounded
<a1> 0-1
<a2> 0-1
<CT> 0-unbounded
<a1> 0-1
<a2> 0-1
<PT> 0-unbounded
<a1> 0-1
<a2> 0-1
<CU> 0-unbounded
<a1> 0-1
<a2> 0-1
</Message>
My Target Structure is
<Message> 1-1
<MTR> 1-unbounded
<METER> 0-unbounded
<a1> 0-1
<a2> 0-1
<CT> 0-unbounded
<a1> 0-1
<a2> 0-1
<PT> 0-unbounded
<a1> 0-1
<a2> 0-1
<CU> 0-unbounded
<a1> 0-1
<a2> 0-1
</MTR>
</Message>
Actually Requirement is Whenever METER or CT or PT or CU repeted that time MTR is to repeat in the Target structure.
Can any body help please
Thanks,
Raghava.
Hi Raja,
Give me an example of what the output should look like for the below source.
Example1:
<Message>
<METER>
<a1>value1</a1>
<a2>value2</a2>
</METER>
<METER>
<a1>value1</a1>
<a2>value2</a2>
</METER>
<CT>
<a1>value1</a1>
<a2>value2</a2>
</CT>
<PT>
<a1>value1</a1>
<a2>value2</a2>
</PT>
<CU>
<a1>value1</a1>
<a2>value2</a2>
</CU>
</Message>
Example2:
<Message>
<METER>
<a1>value1</a1>
<a2>value2</a2>
</METER>
<METER>
<a1>value1</a1>
<a2>value2</a2>
</METER>
<CT>
<a1>value1</a1>
<a2>value2</a2>
</CT>
<CT>
<a1>value1</a1>
<a2>value2</a2>
</CT>
<PT>
<a1>value1</a1>
<a2>value2</a2>
</PT>
<CU>
<a1>value1</a1>
<a2>value2</a2>
</CU>
</Message>
Give the output of what would you like to see. It will be more helpful!
Thanks,
Justin.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Justin
Thanks for your reply
Here is output for
Example1
<Message>
<MTR>
<METER>
<a1>value1</a1>
<a2>value2</a2>
</METER>
<CT>
<a1>value1</a1>
<a2>value2</a2>
</CT>
<PT>
<a1>value1</a1>
<a2>value2</a2>
</PT>
<CU>
<a1>value1</a1>
<a2>value2</a2>
</CU>
</MTR>
<MTR>
<METER>
<a1>value1</a1>
<a2>value2</a2>
</METER>
</MTR>
</Message>
Example2:
<Message>
<MTR>
<METER>
<a1>value1</a1>
<a2>value2</a2>
</METER>
<CT>
<a1>value1</a1>
<a2>value2</a2>
</CT>
<PT>
<a1>value1</a1>
<a2>value2</a2>
</PT>
<CU>
<a1>value1</a1>
<a2>value2</a2>
</CU>
</MTR>
<MTR>
<METER>
<a1>value1</a1>
<a2>value2</a2>
</METER>
<CT>
<a1>value1</a1>
<a2>value2</a2>
</CT>
</MTR>
</Message>
Hi Mark and Justin
Now i am in Big confusion to select which is right answer. here solutions you both provided are perfectly working.
Here SCN not provided option to mark both answers as correct. what will i do now?
I thanking both of you for nice explanation with screenshots
Thanks,
Raghava
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Mark and Justin
Thank you for your extream help.
<Message> 1-1
<MTR> 1-unbounded
<METER> 0-1
<a1> 0-1
<a2> 0-1
<CT> 0-1
<a1> 0-1
<a2> 0-1
<PT> 0-1
<a1> 0-1
<a2> 0-1
<CU> 0-1
<a1> 0-1
<a2> 0-1
</MTR>
</Message>
Firstly I followed Mark Dihiansan way of implementation. I used duplicate structure 3 more times and i did mapping of individual objects.
Then i received four tags of MTR containing each tag METER,CT,PT,CU with attributes.
I will try as you both mentioned in screenshots.
Thank you,
Raghava.
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.
Hi Raja,
Try this.
Mapping for MTR Node (use the count function under statistic)
Mapping for METER, CT, PT, CU (use the same logic as below)
Mapping for a1 & a2, Just map directly from the source.
UDF - To generate no.of MTR nodes based on source node's repetition.
Code:
int [] arr = new int[4];
arr[0] = var1[0];
arr[1] = var2[0];
arr[2] = var3[0];
arr[3] = var4[0];
//Get the MaxRowCount
int maxRowCount = 0;
for (int i=0; i<4; i++){
if ( maxRowCount < arr[i] ) {
maxRowCount = arr[i];
}
}
//Generate the MTR Node
for (int i =0; i<maxRowCount;i++)
{
result.addValue("");
}
Hope it helps! Please do the testing and let us know if it helps!
Thank you,
Justin.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Actually Requirement is Whenever METER or CT or PT or CU repeted that time MTR is to repeat in the Target structure.
I'm not sure if I've understood you completely. If you want to repeat MTR based on the number of occurrences of METER, CT, PT or CU; then all you have to do is right-click on MTR and then select duplicate subtree. Do this three more times and then map them individually.
Regards,
Mark
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
will the repeation of METER ,CT,PT,CU will be same?
if ,yes then you can map METER to MTR.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
89 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.