Skip to main content

Hi,


I have few currency fields displaying on UI as a template field in a table.

When a field value is ZERO, it shows as blank on UI.


Here is the template formula :


{{#discountedPrice}}

{{currencyCode}} {{discountedPrice}}
{{/discountedPrice}}{{#discountedPrice}}
{{currencyCode}} {{listPrice}}
{{/discountedPrice}}

{{^discountedPrice}}{{#listPrice}}
{{currencyCode}} {{listPrice}}
{{/listPrice}}{{/discountedPrice}}


discountedPrice

listPrice - When both of these are ZERO, it shows as blank.


Expected is : 0.00


What I want to do is : display values if it’s not null (Meaning ZERO or any other value except null)


What changes should I have to make for this formula ?

Hi KVin,


It looks like the merging language we use (mustacheJS) does not distinguish between 0 and nulls for its out of the box functionality. So the template is not showing any content when both discountedPrice and listPrice are 0. You could add a section like the bold one below, but then it would treat null values as 0’s and they would show up as 0.00.


{{#discountedPrice}}

{{currencyCode}} {{discountedPrice}}


{{/discountedPrice}}


{{#discountedPrice}}

{{currencyCode}} {{listPrice}}


{{/discountedPrice}}


{{^discountedPrice}}

{{#listPrice}}

{{currencyCode}} {{listPrice}}


{{/listPrice}}
{{^listPrice}}
{{currencyCode}} 0.00

{{/listPrice}}

{{/discountedPrice}}


I think Skuid should add another built in merge function similar to {{#encodeUrl}}{{/encodeUrl}} called {{#isNumberZero}}{{/isNumberZero}} or something like that. That way you could differentiate between zero and null in your merges.


Reply