You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by Adrian Crum <ad...@hlmksw.com> on 2007/08/30 00:48:24 UTC

Simple Method Question

Using minilang, I need to put all of the fields from an entity in the result map. I tried using 
<map-to-map> but that doesn't work. Is there a simple way to put all of a map's elements into the 
result map?

-Adrian


Re: Simple Method Question

Posted by Vikas Mayur <vi...@gmail.com>.
<entity-one entity-name="Product" value-name="mapName.product"/>
<field-to-result field-name="mapName" result-name="mapName"/>

or

<entity-one entity-name="Product" value-name="mapName.product"/>
<field-to-result field-name="mapName" />

I have not tried it but hope this works.


On 8/30/07, Adrian Crum <ad...@hlmksw.com> wrote:
>
> Using minilang, I need to put all of the fields from an entity in the
> result map. I tried using
> <map-to-map> but that doesn't work. Is there a simple way to put all of a
> map's elements into the
> result map?
>
> -Adrian
>
>


-- 
Vikas Mayur

Re: Simple Method Question

Posted by Jonathon -- Improov <jo...@improov.com>.
Why doesn't map-to-map work? Did you mean you wanted to copy every field in a GenericValue object 
to a new map? Then map-to-map will work. The resultant map is NOT a GenericValue object, but a 
plain map.

Oh, the result map.

Don't know any method to do that easily. You could write something like map-to-result. If you want 
that and you want it checked into OFBiz SVN, I think I can do that very quickly. You check it in.

I usually just put all the fields I want to return into a map, like <set field="someMap.fieldA" 
value="Blah"/>. I then do a <field-to-result field-name="someMap"/>. That way, I am able to return 
a large set of values. I think this is the better/best practice. Like in Java functions, you don't 
see functions returning a whole chunk of values, but instead return a collection.

Jonathon

Adrian Crum wrote:
> Using minilang, I need to put all of the fields from an entity in the 
> result map. I tried using <map-to-map> but that doesn't work. Is there a 
> simple way to put all of a map's elements into the result map?
> 
> -Adrian
> 
>