on 2022 Aug 23 2:17 PM
hi
Can anyone suggest way to extract records or filter records inside iflow based on multiple condition.
We are using odata v2 get query where filter option doesnt work on fields(nested) other than root at channel level .
from iflow i need to select only those xml records who qualify conditions like id = masProdCat and version = staged.
<Products>
<Product>
<catalogVersion>
<CatalogVersion>
<catalog>
<Catalog>
<id>norProdCat</id>
</Catalog>
</catalog>
<version>Archived</version>
</CatalogVersion>
</catalogVersion>
<code>W1</code>
<manufacturerName/>
<rebFlag/>
<subTerm/>
</Product>
Help others by sharing your knowledge.
AnswerRequest clarification before answering.
You can use below code
import com.sap.gateway.ip.core.customdev.util.Message
import java.util.HashMap
import groovy.xml.XmlUtil
def Message processData(Message message) {
String body = message.getBody(java.lang.String)
def root = new XmlParser().parseText(body);
root.Product.findAll {it.catalogVersion.CatalogVersion.catalog.Catalog.id.text() != "masProdCat" && it.catalogVersion.CatalogVersion.version.text() != "staged"}.each{
it.replaceNode {}
}
message.setBody(XmlUtil.serialize(root)) //pretty print XML.
return message
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
58 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.