Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Published by Scroll Versions from space DEV and version r093
Excerpt

In this example, you can see how the CHAR function can be used to convert numeric index values to Unicode characters, and the UNICODE function can be used to convert characters back to numeric values.

Functions:

D generate list excerpts
pagesCHAR Function,UNICODE Function

Source:

The following column contains some source index values:

index
1
33
33.5
34
48
57
65
90
97
121
254
255
256
257
9998
9999

Transformation:

When the above values are imported to the Transformer page, the column is typed as integer, with a single mismatched value (33.5). To see the corresponding Unicode characters for these characters, enter the following transformation:

D trans
RawWrangletrue
p03Value'char_index'
Typestep
WrangleTextderive type:single value: CHAR(index) as: 'char_index'
p01NameFormula type
p01ValueSingle row formula
p02NameFormula
p02ValueCHAR(index)
p03NameNew column name
SearchTermNew formula

To see how these characters map back to the index values, now add the following transformation:

D trans
RawWrangletrue
p03Value'unicode_char_index'
Typestep
WrangleTextderive type:single value: UNICODE(char_index) as: 'unicode_char_index'
p01NameFormula type
p01ValueSingle row formula
p02NameFormula
p02ValueUNICODE(char_index)
p03NameNew column name
SearchTermNew formula

Results:

indexchar_indexunicode_char_index
1 1
33!33
33.5  
34"34
48048
57957
65A65
90Z90
97a97
122z122
254þ254
255ÿ255
256Ā256
257ā257
99989998
99999999

Note that the floating point input value was not processed. 

D s also
labelexample_unicode_function