App Connect Data Formatter Support Product Page

Answered

padNumber equivalent

6 years ago David Woolley posted:
What is the equivalent App Connect formatter for HTML5 Data Bindings Formatter padNumber( ) ?
I need to convert a numerical field to a 4 character string with leading zeros.

For example:

9 --> "0009"

99 --> "0099"

999 --> "0999"

9999 --> "9999"

Replies

Replied 6 years ago
6 years ago Teodor Kuduschiev replied:
Hello David,
The Pad formatter has always been available under Numeric formatters.
Replied 6 years ago
6 years ago David Woolley replied:
Hi Teodor
There is no Numeric option in the current App Connect Data Formatter that I have installed in DW CC 2017
Menu options are:
  • Operation
  • Date and Time
  • General
  • Conversion
  • Conditional
  • Transform
  • Manipulation
  • Analyse


I tried startPad( 4, 0 ) but this only works on a string, So the number needs to be converted to a string first - I don't see this option anywhere.

I see in one of your videos: 'Formatting numeric values with DMXzone app connect data formatter'
that the menu options are different:
  • Conversion
  • Operation
  • Date and Time
  • General
  • Conditional
  • Numeric



Replied 6 years ago
6 years ago Teodor Kuduschiev replied:
Are you sure the data is returned as number and not as string then?
Replied 6 years ago
6 years ago David Woolley replied:
It is returned as a number type in the query - Chrome Tools complained that startPad can't be used on a number
Replied 6 years ago
6 years ago Teodor Kuduschiev replied:
Please try selecting Number in the data picker dialog and the numeric filters will appear.
Replied 6 years ago
6 years ago David Woolley replied:
Thanks Teodor - that worked!
I see the pad() does automatically pad the text with zeros, unlike the old padNumber where one had to specify the leading character. (It defaulted to zero if one did not specify this character)

And the formatter option menu is contextual, depending on the Type selected - I did not realize this.

Getting there ...

Reply to this topic