Concatenation with assign operator

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

Concatenation with assign operator

anjibman
Hi All,

What will be easy way to do this in freemarker

if(someValue == null) {
     result = loc1Path + defaultValue;
}
else {
   result = loc2Path + someValue;
}

I can have like this free marker

<#assign result = someValue ! defaultValue/>

but did't find a easy way to concatenate path.

Any suggestion?
Reply | Threaded
Open this post in threaded view
|

Re: Concatenation with assign operator

Daniel Dekany
Friday, July 12, 2013, 11:33:54 PM, anjibman wrote:

> Hi All,
>
> What will be easy way to do this in freemarker
>
> if(someValue == null) {
>      result = loc1Path + defaultValue;
> }
> else {
>    result = loc2Path + someValue;
> }
>
> I can have like this free marker
>
> <#assign result = someValue ! defaultValue/>
>
> but did't find a easy way to concatenate path.

If indeed both sides of the "+" changes depending on if someValue
exists, then:

  (loc2Path + someValue)!(loc1Path + defaultValue)

If the locPath part is always the same:

  locPath + (someValue!defaultValue)

> Any suggestion?
>
>
>
>
> --
> View this message in context:
> http://freemarker.624813.n4.nabble.com/Concatenation-with-assign-operator-tp4654636.html
> Sent from the freemarker-user mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> See everything from the browser to the database with AppDynamics
> Get end-to-end visibility with application monitoring from AppDynamics
> Isolate bottlenecks and diagnose root cause in seconds.
> Start your free trial of AppDynamics Pro today!
> http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
> _______________________________________________
> FreeMarker-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/freemarker-user
>

--
Thanks,
 Daniel Dekany


------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
FreeMarker-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-user