Closed buttonpushertv closed 8 months ago
It should be up to your "multiply" helper to decide if the strings being passed to it can be treated as numbers.
I'm using the built in handlebar helpers referenced on the ReadMe page. How do I tell them to interpret a value as a number? (Using the nested format doesn't work either).
Using a custom helper does work, but I was hoping to use what's already built in, if it can be made to work.
Oh, and the value that gets passed to my custom helper workaround appears to the function as a numeric value without any need for my helper to convert it to a number type.
Does that mean that the importer is seeing the value type correctly and the mustache math helpers are not interpreting it as a number? (Which is frustrating because I'm constructing it as they show in their examples.)
I just tried it with the data you provided earlier. Using pack.burgs
as the "Field containing the data", I get the correct values when using the handlebars expression
population: {{population}}
population2: {{multiply population 1000}}
Strange. Maybe there's another plugin interfering. I'll see what I can find out by disabling others and troubleshooting.
Closing this one (since you've determined it works as intended). I'll report back if I discover anything that be conflicting and causing it to not work on my end.
Thanks.
Extracted values from JSON, even when they are number values, do not get passed to the math Handlebar Helpers as numbers. For example, pulling data from a Fantasy Map Generator JSON, the value at
pack.burgs[x].population
is a number that needs to be multiplied by 1000 to shift it to the correct value.Using the mustache helper:
{{multiply 1000 population}}
in a template when importing fails with an error thatpopulation
is not a number.Even using a nested helper like: {{multiply 1000 (toFloat population)}} fails with the same error.
I've resorted to using a custom js helper, but is there a different method or way to force a value like
population
to be interpreted as a number?