field-to-result ¿default-value?

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

field-to-result ¿default-value?

david.cuenca
I have a simple-method, implementing a service, where I get some values
from the Entity Engine in a map. Then I copy some fields from this map
to the service result field.
Well, with some conditions the map that I obtain from the Entity Engine
is empty (and has to be empty). So I would like to be able to use
something like
<field-to-result field-name="product.productName"
result-name="productName"  default-value="NA" />
But there is no solution as simple as this, because the clause
default-value is not avaliable. Which is the most elegant solution to do
this?

Thank you
Reply | Threaded
Open this post in threaded view
|

Re: field-to-result ¿default-value?

jonwimp
Do a pre-check on product.productName using <if-empty>. If empty, insert your default value into
the env variable.

Jonathon

David Cuenca wrote:

> I have a simple-method, implementing a service, where I get some values
> from the Entity Engine in a map. Then I copy some fields from this map
> to the service result field.
> Well, with some conditions the map that I obtain from the Entity Engine
> is empty (and has to be empty). So I would like to be able to use
> something like
> <field-to-result field-name="product.productName"
> result-name="productName"  default-value="NA" />
> But there is no solution as simple as this, because the clause
> default-value is not avaliable. Which is the most elegant solution to do
> this?
>
> Thank you
>
>

Reply | Threaded
Open this post in threaded view
|

Re: field-to-result ¿default-value?

cjhowe
Alternatively,
<set field="productName" from-field="product.productName"
default-value="NA"/>
<field-to-result field="productName"/>

--- Jonathon -- Improov <[hidden email]> wrote:

> Do a pre-check on product.productName using <if-empty>. If empty,
> insert your default value into
> the env variable.
>
> Jonathon
>
> David Cuenca wrote:
> > I have a simple-method, implementing a service, where I get some
> values
> > from the Entity Engine in a map. Then I copy some fields from this
> map
> > to the service result field.
> > Well, with some conditions the map that I obtain from the Entity
> Engine
> > is empty (and has to be empty). So I would like to be able to use
> > something like
> > <field-to-result field-name="product.productName"
> > result-name="productName"  default-value="NA" />
> > But there is no solution as simple as this, because the clause
> > default-value is not avaliable. Which is the most elegant solution
> to do
> > this?
> >
> > Thank you
> >
> >
>
>