如何使用DataWeave 2.0基于XPR中的逻辑更新DToSteps节点值
就我而言,我有两个有效载荷:DOMDRC和DOMPAYLOAD(第二有效载荷)。
我必须迭代层(子节点),并根据DOMDRC有效载荷中的值和含有等于“ y”的dompayload中的dtocoverage和dtoratearea的dtoStep值。
逻辑:
nodes = domDRC.getRootElement().selectNodes("/Envelope/Body/rateResponse/RateResult/Layers/Layer","LayerNum");
for (Node node : nodes) {
if (node.valueOf("InclFlag") == 'Y') {
if ( (int) node.valueOf("LayerPremNonAuto") > 0) {
// NonAuto Layer
//add the DTOStep in CEL DTOCoverage of 2 nd payload
//add the DTOStep in DTORateArea of 2 nd payload and DTORateArea attributes values(AreaName, Description, FullTermAmt, FinalPremiumAmt, WrittenPremiumAmt)
}
if ( (int) node.valueOf("LayerPremAuto") > 0) {
// Auto Layer
//add the DTOStep in CEL DTOCoverage of 2 nd payload
//add the DTOStep in DTORateArea of 2 nd payload and DTORateArea attributes values(AreaName, Description, FullTermAmt, FinalPremiumAmt, WrittenPremiumAmt)
}
}
}
domdrc pareload(input): https://github.com/manikandan99/java-code-datawaweave-2/lob/main/main/mmain/mmain/domdrc_payload.xml
dom有效载荷(第二有效载荷)(输入): https://github.com/manikandan99/java-code-te-dataweave-2/blob/main/main/main/main/dom_payload(2nd).xml
https://github.com/manikandan99/java-code-to-dataweave-2/blob/main/main/logic_auto_auto_split_xpr.txt ://github.com/Manikandan99/java-code-to-dataweave-2/blob/main/transform_DOM_payload.dwl" rel="nofollow noreferrer">https://github.com/Manikandan99/java-code-to- dataweave-2/blob/main/transform_dom_payload.dwl
专家请浏览链接。
在m子3中,我使用表达式转换DOM有效载荷。在进行迁移时,由于m子4中表达组件的不可用。我想选择DataWeave 2.0。我已经连接了尝试的数据拖曳,但是我无法通过DOMDRC解决迭代,并从DOMDRC有效载荷中的Layer Node获取值,然后更新到IT DOM有效载荷DTOSTEPS。
请帮助我,并提前感谢。
关于如何将auto_split xpr转换为dataweave 2.0的任何想法?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我的两分钱:不要指望从XPR(无论是什么)直接迁移到数据驱动。我强烈建议您在不使用的那些Java功能的情况下从头开始进行此操作(我认为它们根本不需要)。
寻找您以前做过的其他类似问题,@ALED也对您有所帮助,似乎您真正需要的是了解DataWeave 2如何工作以及它必须解决您所拥有的要求的功能。
因此,我建议您查看以下内容:
官方文档可帮助您帮助您有用的信息与此。
但是,查看您在这里共享的摘要逻辑(Github中没有一个,因为有了示例和脚本,这根本不清楚),您可以从做类似的事情开始:
我也建议您尝试抽象一下问题和特定(特定问题/问题,因为这是一个Q&一个网站,不要期望别人从您共享的代码中开发某些内容),请减少输入/预期数据的示例,以便此处的社区可以帮助您。
My two cents: don't expect a straightforward migration from XPR (whatever that is) to DataWeave. I'd strongly recommend you to do it from scratch without those Java functions you're using right now (I don't think they are necessary at all).
Looking to other similar questions you did before, that @aled has kindly help you with, it seems that what you really need is to understand how DataWeave 2 works and the features it has to solve the requirements you have.
So, I'd recommend you to take a look at the following content:
The official documentation has quite useful information to help you with this.
Nonetheless, looking at the snippet logic you're sharing in here (no the ones in GitHub, since with the examples and scripts it's not clear at all), you can start by doing something like:
I also recommend you to try to abstract the problems and be specific (specific questions/problems, since this is a Q&A site, don't expect someone else to develop something from a code you share), reduce the examples for the input/expected data so the community in here can help you.