nested loops in runStringTemplateOnPipe

All:

I’m trying the following code in the runStringTemplateOnPipe service -

<?xml version="1.0" encoding="UTF-8"?>

%loop categoryList%

<part_category name=‘%value categoryName%’> - (1)

%loop spareParts%

%value categoryName% - (2)
%value category% - (3)

%endloop%

</part_category>

%endloop%

The CategoryList is a documentList, with each document containng just a categoryName. The spareParts is a documentList, with each document containing (description, category, quantity).

I’m doing a loop within a loop. I’m getting the value successfully in step(1), but not in (2) and (3).

Can someone let me know what could be the reason for this,

Thanks.

If I understood you correctly you are trying to loop over another document (spareParts) while being already in a loop of categoryList document.

If so: when you are inside loop your scope changes to values only from that document and to refer to another values you should refer to them differently. Check section scope in dsp manual.

Thank you. I did the same thing, like, making the structures nested within each other. I’m still wondering how this kind of a thing is not permissible in DSP output template looping. I have a “scope” option in the runStringTempalteOnPipe utility. Not sure if that’s going to help in this direction. Didn’t find any relevant info in the manual.

Hi,

I have a simillar problem, i am tring to use nested loop but can only display first item of nested loop. If you have found any solution then please share with me.

Thanks
Atul