App Connect Data Formatter Support Product Page

Answered

padNumber equivalent

Asked 17 Sep 2018 15:26:30
1
has this question
17 Sep 2018 15:26:30 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 18 Sep 2018 06:50:44
18 Sep 2018 06:50:44 Teodor Kuduschiev replied:
Hello David,
The Pad formatter has always been available under Numeric formatters.
Replied 18 Sep 2018 07:24:09
18 Sep 2018 07:24:09 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 18 Sep 2018 07:28:24
18 Sep 2018 07:28:24 Teodor Kuduschiev replied:
Are you sure the data is returned as number and not as string then?
Replied 18 Sep 2018 07:34:24
18 Sep 2018 07:34:24 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 18 Sep 2018 07:47:34
18 Sep 2018 07:47:34 Teodor Kuduschiev replied:
Please try selecting Number in the data picker dialog and the numeric filters will appear.
Replied 18 Sep 2018 08:07:48
18 Sep 2018 08:07:48 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