Decimal fields are shown as blank on UI when the value is ZERO
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}}<div style="font-weight: bold">{{currencyCode}} {{discountedPrice}}</div>{{/discountedPrice}}{{#discountedPrice}}<div style="color :DimGray ;text-decoration: line-through">{{currencyCode}} {{listPrice}}</div>{{/discountedPrice}}
{{^discountedPrice}}{{#listPrice}}<div style="font-weight:bold">{{currencyCode}} {{listPrice}}</div>{{/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 ?
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}}<div style="font-weight: bold">{{currencyCode}} {{discountedPrice}}</div>{{/discountedPrice}}{{#discountedPrice}}<div style="color :DimGray ;text-decoration: line-through">{{currencyCode}} {{listPrice}}</div>{{/discountedPrice}}
{{^discountedPrice}}{{#listPrice}}<div style="font-weight:bold">{{currencyCode}} {{listPrice}}</div>{{/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 ?
1
Categories
- 7.9K Questions
- 926 Ideas
- 220 Discussion Categories
- 178 General
- 9 Community Feedback
- 3 Community Info
- 18 Knowledge Base
Comments
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}}
<div style="font-weight: bold">{{currencyCode}} {{discountedPrice}}</div>
{{/discountedPrice}}
{{#discountedPrice}}
<div style="color :DimGray ;text-decoration: line-through">{{currencyCode}} {{listPrice}}</div>
{{/discountedPrice}}
{{^discountedPrice}}
{{#listPrice}}
<div style="font-weight:bold">{{currencyCode}} {{listPrice}}</div>
{{/listPrice}}
{{^listPrice}}
<div style="font-weight:bold">{{currencyCode}} 0.00</div>
{{/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.