-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conditional TSS treats floating point zero as blank #218
Comments
You would need to run the number through a formatter first, which would convert it to a string. |
My example above was perhaps a bit too limited. The data value is a floating point number in my real application, and my TSS (with my current work-around) looks like this: /* Do not try to display missing values. */
td span.amount:[data(output.paid_amount)!=""] {
content: "$", data(output.paid_amount);
format: decimal 2;
}
/* DO display zero values. */
td span.amount:[data(output.paid_amount)=0] {
content: "$", data(output.paid_amount);
format: decimal 2;
} |
In the example above, you're doing the same thing for both situations, 0 and not null. Do you want different behaviour on both |
Yes, I think that's the crux of the issue. The API I'm calling returns a numeric currency amount as 0.00 through (say) 9999.99, OR it will not return the currency element at all. When it is zero or other numeric, I want to format it nicely. Otherwise, I don't want to display anything, e.g. thus leaving out a lone Am I making it clear now? |
It would be nice if the following worked as expect, displaying the value
$0.00
instead of leaving the XML unaltered.I have frequent need for this kind of check in my TSS code because the application service classes I'm calling don't always return every data element.
Is there perhaps a work-around I don't know about?
The text was updated successfully, but these errors were encountered: