Quantcast

No other way of handling missing values?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
tim
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

No other way of handling missing values?

tim
I am checking on a flag that sometimes is missing/NULL and sometimes it exists in the model but is false.

The only way to securely check on the flag I found is:

<#if (c.royaltyTerms.OffsetLimit.perProductYn)??> (see if it is NULL)
<#if (c.royaltyTerms.OffsetLimit.perProductYn=="Y")> (see if is true/set)

Is there no better way? I appreciate the possibility of differentiating between NULL and existing, but it is only very rare cases in which such a check is required. In 90% of the cases you want a missing value be treated as an existing but not matching value... In the freemarker docs it says that Freemarker is picky about NULL values in its standard configuration. But I found no configuration to change this behavior. Is there any?

Cheers,
Tim
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: No other way of handling missing values?

Andy
probably this still works:

<#if (((c.royaltyTerms.OffsetLimit.perProductYn)!"N")=="Y")>

On Fri, Feb 13, 2015 at 8:16 PM, tim <[hidden email]> wrote:
I am checking on a flag that sometimes is missing/NULL and sometimes it
exists in the model but is false.

The only way to securely check on the flag I found is:

<#if (c.royaltyTerms.OffsetLimit.perProductYn)??> (see if it is NULL)
<#if (c.royaltyTerms.OffsetLimit.perProductYn=="Y")> (see if is true/set)

Is there no better way? I appreciate the possibility of differentiating
between NULL and existing, but it is only very rare cases in which such a
check is required. In 90% of the cases you want a missing value be treated
as an existing but not matching value... In the freemarker docs it says that
Freemarker is picky about NULL values in its standard configuration. But I
found no configuration to change this behavior. Is there any?

Cheers,
Tim

------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
FreeMarker-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: No other way of handling missing values?

Daniel Dekany
In reply to this post by tim
If only the last step in the chain can be missing (`perProductYn`),
then you don't need all that (...). And as Andy said, you could use
`exp!default == exp`. You can also use `exp! == exp` as `"" != "Y"`.
So at the end you end up with:

  <#if c.royaltyTerms.OffsetLimit.perProductYn! == "Y">


Friday, February 13, 2015, 1:16:27 PM, tim wrote:

> I am checking on a flag that sometimes is missing/NULL and sometimes it
> exists in the model but is false.
>
> The only way to securely check on the flag I found is:
>
> <#if (c.royaltyTerms.OffsetLimit.perProductYn)??> (see if it is NULL)
> <#if (c.royaltyTerms.OffsetLimit.perProductYn=="Y")> (see if is true/set)
>
> Is there no better way? I appreciate the possibility of differentiating
> between NULL and existing, but it is only very rare cases in which such a
> check is required. In 90% of the cases you want a missing value be treated
> as an existing but not matching value... In the freemarker docs it says that
> Freemarker is picky about NULL values in its standard configuration. But I
> found no configuration to change this behavior. Is there any?
>
> Cheers,
> Tim
>
>
>
> --
> View this message in context:
> http://freemarker.624813.n4.nabble.com/No-other-way-of-handling-missing-values-tp4655373.html
> Sent from the freemarker-user mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> Dive into the World of Parallel Programming. The Go Parallel Website,
> sponsored by Intel and developed in partnership with Slashdot Media, is your
> hub for all things parallel software development, from weekly thought
> leadership blogs to news, videos, case studies, tutorials and more. Take a
> look and join the conversation now. http://goparallel.sourceforge.net/
> _______________________________________________
> FreeMarker-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/freemarker-user
>

--
Thanks,
 Daniel Dekany


------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
FreeMarker-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-user
Loading...