[minilang] how to add a map to a list?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[minilang] how to add a map to a list?

Leon Torres-2
How do I add a map onto a list in minilang?  I tried the following and instead
of my maps, I get N copies of the last map added,

<!-- loop through GenericValues -->
<iterate list-name="requirementsForSupplier" entry-name="req">
   <map-to-map map-name="req" to-map-name="requirement"/>
   <field-to-list field-name="requirement" list-name="requirements"/>
</iterate>
<field-to-result field-name="requirements" result-name="requirementsForSupplier"/>

If you have to ask why, I'm doing a union of the GenericValue fields with other
data fields so that the form widget that invokes this service can list them all
together.

- Leon
Reply | Threaded
Open this post in threaded view
|

Re: [minilang] how to add a map to a list?

David E Jones

It sounds like the problem is that with map-to-map it doesn't create  
a new Map if one exists, it just adds all entries from the one Map to  
the other.

If you need to clone (or rather, shallow copy) the Map then you can  
do the same thing but add a clear-field on the "requirement" field  
before the map-to-map operation. If you don't need to clone the Map,  
just remove the map-to-map and in the field-to-list change it to use  
"req".

-David


On Jan 26, 2007, at 5:08 PM, Leon Torres wrote:

> How do I add a map onto a list in minilang?  I tried the following  
> and instead of my maps, I get N copies of the last map added,
>
> <!-- loop through GenericValues -->
> <iterate list-name="requirementsForSupplier" entry-name="req">
>   <map-to-map map-name="req" to-map-name="requirement"/>
>   <field-to-list field-name="requirement" list-name="requirements"/>
> </iterate>
> <field-to-result field-name="requirements" result-
> name="requirementsForSupplier"/>
>
> If you have to ask why, I'm doing a union of the GenericValue  
> fields with other data fields so that the form widget that invokes  
> this service can list them all together.
>
> - Leon


smime.p7s (3K) Download Attachment