英文:
BizTalk Mapping: How to show a parent record once only if there are 1 or more child records. Otherwise, do not show parent record
问题
我只会翻译您提供的文本,不会提供额外内容。以下是您的文本的翻译:
"I would like to show a parent record only if one or more child records have values. Otherwise, I do not want the parent record to show up in the output at all."
我希望只在一个或多个子记录具有值时显示父记录。否则,我不希望父记录出现在输出中。
"If this is the input..."
如果这是输入...
"Then I would like there to be no output"
那么我希望没有任何输出。
"If this is the input..."
如果这是输入...
"Then I would like this to be the output"
那么我希望这是输出。
"With this mapping, I get the proper output if there are child records and values. However, the output contains the parent record..."
使用这个映射,如果有子记录和值,我会得到正确的输出。然而,输出包含了父记录...
"With this mapping, there is no parent record if there are not child records or values but the output is not correct if there are values"
使用这个映射,如果没有子记录或值,就没有父记录,但是如果有值,输出是不正确的。
"This is the output if with the second mapping if there are child records and values"
如果有子记录和值,这是使用第二个映射的输出。
"It causes the parent record to be duplicated with each iteration of the child records. I would like all of the child records to be contained within the one Parent record."
这会导致父记录在每次子记录迭代时重复。我希望所有子记录都包含在一个父记录中。
英文:
I would like to show a parent record only if one or more child records have values. Otherwise, I do not want the parent record to show up in the output at all.
If this is the input
<PO_ALLOWANCES_CHARGES>
<ALLOW_CHARGE>
<TYPE/>
<CODE/>
<PERCENTQUALIFIER/>
<PERCENT/>
<RATE/>
<METHODOFHANDLING/>
<DESCRIPTION/>
<AMOUNT/>
</ALLOW_CHARGE>
</PO_ALLOWANCES_CHARGES>
Then I would like there to be no output
If this is the input
<PO_ALLOWANCES_CHARGES>
<ALLOW_CHARGE>
<TYPE>A</TYPE>
<CODE>ABCD</CODE>
<PERCENTQUALIFIER>A</PERCENTQUALIFIER>
<PERCENT>14.598</PERCENT>
<RATE>18.54</RATE>
<METHODOFHANDLING>AB</METHODOFHANDLING>
<DESCRIPTION>TEST Allow Charge Desc</DESCRIPTION>
<AMOUNT>104.52</AMOUNT>
</ALLOW_CHARGE>
<ALLOW_CHARGE>
<TYPE>B</TYPE>
<CODE>BCDE</CODE>
<PERCENTQUALIFIER>B</PERCENTQUALIFIER>
<PERCENT>24.598</PERCENT>
<RATE>28.54</RATE>
<METHODOFHANDLING>BC</METHODOFHANDLING>
<DESCRIPTION>TEST Allow Charge Desc 02</DESCRIPTION>
<AMOUNT>204.52</AMOUNT>
</ALLOW_CHARGE>
</PO_ALLOWANCES_CHARGES>
Then I would like this to be the output
<ns0:POAllowAndCharges>
<ns3:POAckAllowAndChargeType>
<ns3:ChargeId>1</ns3:ChargeId>
<ns3:ChargeType>A</ns3:ChargeType>
<ns3:ChargeCode>ABCD</ns3:ChargeCode>
<ns3:PctQualifier>A</ns3:PctQualifier>
<ns3:Pct>14.598</ns3:Pct>
<ns3:Rate>18.54</ns3:Rate>
<ns3:MethodOfHandling>AB</ns3:MethodOfHandling>
<ns3:ChargeDesc>TEST Allow Charge Desc</ns3:ChargeDesc>
<ns3:Amount>104.52</ns3:Amount>
</ns3:POAckAllowAndChargeType>
<ns3:POAckAllowAndChargeType>
<ns3:ChargeId>2</ns3:ChargeId>
<ns3:ChargeType>B</ns3:ChargeType>
<ns3:ChargeCode>BCDE</ns3:ChargeCode>
ns3:PctQualifier>B</ns3:PctQualifier>
<ns3:Pct>24.598</ns3:Pct>
<ns3:Rate>28.54</ns3:Rate>
<ns3:MethodOfHandling>BC</ns3:MethodOfHandling>
<ns3:ChargeDesc>TEST Allow Charge Desc 02</ns3:ChargeDesc>
<ns3:Amount>204.52</ns3:Amount>
</ns3:POAckAllowAndChargeType>
</ns0:POAllowAndCharges>
With this mapping, I get the proper output if there are child records and values. However, the output contains the parent record <ns0:POAllowAndCharges>
With this mapping, there is no parent record if there are not child records or values but the output is not correct if there are values
This is the output if with the second mapping if there are child records and values
<ns0:POAllowAndCharges>
<ns3:POAckAllowAndChargeType>
<ns3:ChargeId>1</ns3:ChargeId>
<ns3:ChargeType>A</ns3:ChargeType>
<ns3:ChargeCode>ABCD</ns3:ChargeCode>
<ns3:PctQualifier>A</ns3:PctQualifier>
<ns3:Pct>14.598</ns3:Pct>
<ns3:Rate>18.54</ns3:Rate>
<ns3:MethodOfHandling>AB</ns3:MethodOfHandling>
<ns3:ChargeDesc>TEST Allow Charge Desc</ns3:ChargeDesc>
<ns3:Amount>104.52</ns3:Amount>
</ns3:POAckAllowAndChargeType>
</ns0:POAllowAndCharges>
<ns0:POAllowAndCharges>
<ns3:POAckAllowAndChargeType>
<ns3:ChargeId>2</ns3:ChargeId>
<ns3:ChargeType>B</ns3:ChargeType>
<ns3:ChargeCode>BCDE</ns3:ChargeCode>
<ns3:PctQualifier>B</ns3:PctQualifier>
<ns3:Pct>24.598</ns3:Pct>
<ns3:Rate>28.54</ns3:Rate>
<ns3:MethodOfHandling>BC</ns3:MethodOfHandling>
<ns3:ChargeDesc>TEST Allow Charge Desc 02</ns3:ChargeDesc>
<ns3:Amount>204.52</ns3:Amount>
</ns3:POAckAllowAndChargeType>
</ns0:POAllowAndCharges>
It causes the parent record to be duplicated with each iteration of the child records. I would like all of the child records to be contained within the one Parent record.
Does anyone know how I might achieve something like this?
答案1
得分: 0
你差不多到了
- 你不需要循环函数,它已经知道要循环。
- 你需要为POAllowAndCharges使用累积连接函数。
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论