Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

Loop through multiple subForms in Form ( ALD) for SAP C4C

Avatar

Level 2

Dear All,

I have requirement to design a Form and i need to fetch the city of Shipment from FormAddress of Product Recipient party in Form.

loopthrough SubFormsin C4C.PNG

please check my DataView(Model) for the same.

Now as u can see my firlst level ResolveNodes is working and fetching the Formattedname but second level resolvenode is not giving me any data.

Kindly help.

Example data mode:

<FormQuote>
  
<ID>5125</ID>
  
<Date>2019-04-02</Date>
  
<ProductRecipientParty>
  
<InternalID>C00009</InternalID>
  
<SellerID>C00009</SellerID>
  
<FormAddress>
  
<FormattedAddressDescription>xyz/3300/HU</FormattedAddressDescription>
  
<CityName>Eger</CityName>
  
</FormAddress>
  
<FormattedName>Aventics Hungary Kft.</FormattedName>
  
</ProductRecipientParty>
 
</FormQuote>

As you can see i want to go to FormAddress SubForm and i have tried a lot of approaches.

Can some1 help me in this.

BR

Dhruvin

1 Accepted Solution

Avatar

Correct answer by
Level 10

So if I understand well, you want to access each FormAddress within each ProductRecipientParty, right?

So by setting a variable named PRDL with the resolveNodes of ProductRecipientParty, you should be able to access FormAddress with that variable by using the resolveNodes on each item:

var PRDL = reference_syntax.resolveNodes("ProductRecipientParty[*]");

for (var i = 0, iLength = PRDL.length; i < iLength; i++){

     var FRMADD = PRDL.item(i).resolveNodes("FormAddress[*]");

     for (var ii = 0, iiLength = FRMADD.length; ii < iiLength; ii++){

          var oneFormAddress = FRMADD.item(ii);

     }

}

I hope this will help you.

View solution in original post

5 Replies

Avatar

Level 10

Hi there,

Just to check in with you, it seems like the iteration you are doing until you reach the number ilength would not work because ilength is not defined? Maybe something's missing like

Let me know if this solves your issue

Avatar

Level 2

Hi Magus069,

Thanks a lot for your response.

You can kindly ignore that line, I just want to know how can I traverse through subForms using resolveNodes?

BR

Dhruvin

Avatar

Level 10

For any subform that has multiple instances, you can iterate through each of em using resolveNodes with the following statement:

I hope this will help you

Avatar

Level 2

Hi,

Thanks a lot for ur response. I did not understand your response.

The problem is not that i am not able to "Loop" the problem is

I have in my Data View Tree,

Main Header is FromQuote.

Parent Subform is ProductRecipientParty and

Child of ProductRecipientParty is FormAddress.

I am able to access ProductRecipientParty like Below,

But i want to access now FormAddress

So how can i use resolveNodes for the same?

I hope this is more clear where i am stuck.

BR

Dhruvin

Avatar

Correct answer by
Level 10

So if I understand well, you want to access each FormAddress within each ProductRecipientParty, right?

So by setting a variable named PRDL with the resolveNodes of ProductRecipientParty, you should be able to access FormAddress with that variable by using the resolveNodes on each item:

var PRDL = reference_syntax.resolveNodes("ProductRecipientParty[*]");

for (var i = 0, iLength = PRDL.length; i < iLength; i++){

     var FRMADD = PRDL.item(i).resolveNodes("FormAddress[*]");

     for (var ii = 0, iiLength = FRMADD.length; ii < iiLength; ii++){

          var oneFormAddress = FRMADD.item(ii);

     }

}

I hope this will help you.