on 10-08-2018 8:31 AM
Could you pls help me out on reading sub field. for example I have
Sales node which has many sub fields (note: Sales node is coming as list)
Sales-->
->id
->name
->dept
can you help me reading this name field, Actually sales field is coming as list,I want to read all the names and concatenate it
sample xml code
<Sales>
<id>101</id>
<name>XDG</name>
<dept>4XR1</dept>
</Sales>
<Sales>
<id>102</id>
<name>ZTY</name>
<dept>6ZY1</dept>
</Sales>
<Sales>
<id>103</id>
<name>GER</name>
<dept>27SD</dept>
</Sales>
It would be great if you provide a sample input xml and expected output xml so that forum can get better clarification.
But below is under my assumption:
Script :
import com.sap.it.api.mapping.*;
def void Append(String[] inp, Output output, MappingContext context) {
String value1="";
for(int i=0;i<inp.length;i++)
{value1=value1 + inp[i];}
output.addValue(value1);
}
Br,
Manoj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rashmi ,
Concatenation takes a static number of fields :
Ex : FNAME: Manoj and LNAME: K so we can concatenate using the standard function as we know there are 2 fields.
But in this case it's a repeating node we need to concatenate the elements in the array.
It's the same way we do in PI.
Br,
Manoj
Hi Manoj,
Could you please share your screenshot of Messagemapping in iflow
I have input coming as list but when it comes to iFlow Mapping
I see the following items only once
Sales
id
name
dept
If I map the name to SalesNames field directly with groovy script you provided above. I receive only one value always. the count is always only one. Hope you understand my problem. How to get all the names in this scenario.
In other ways, can you read the item List directly which has all information like title, information and quantity. In my case reading the entire sales list contains name.id,dept etc. is that possible in groovy to ready top node?
Name--->RemoveContext-->Script-->SalesName
User | Count |
---|---|
89 | |
10 | |
10 | |
9 | |
6 | |
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.