Types conversions
Name | Description | Usage | Samples |
---|---|---|---|
toString | Attempts to convert a type to a string. Can be used to make sure an interface value is always a string. | toString(undefined) | {{ toString 100 }} |
toFloat | Converts a string to float. Created value can be used on other helper functions. | toFloat(string) | {{ toFloat “100.23” }} |
toInt | Converts a string to int. Created value can be used on other helper functions. | toInt(string) | {{ toInt “100” }} |
toBool | Converts a string, int or float to boolean. Created value can be used on other helper functions. | toBool(string) | {{ toBool “1” }} |
intToString | Converts a int to string. Created value can be used on other helper functions. | intToString(int) | {{ intToString 100 }} |
stringToUint32 | Converts a string to int32. Created value can be used on other helper functions. | stringToUint32(string) | {{ stringToUint32 “100” }} |
intToUint32 | Converts a int to int32. Created value can be used on other helper functions. | intToUint32(int) | {{ intToUint32 100 }} |
floatToString | Converts a float to string. Created value can be used on other helper functions. | floatToString(float64) | {{ floatToString 100.5 }} |
floatToInt | Converts a float to int. Created value can be used on other helper functions. | floatToString(float64) | {{ floatToInt 100.5 }} |
floatToEvenString | Converts a float to int and returns as a string. Created value can be used on other helper functions. | floatToEvenString(float64) | {{ floatToEvenString 100.5 }} |
Example where the data could be stored in a JS variable for js usage.
<script>
(function () {
const myData = JSON.parse({{ .Data.WMSApi.ProductPickingEfficiencyList | toJson}})
})();
</script>