Alteryx Designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.
The Expert Exam is now live online! Read about the specifics and what it took to bring it to life in the blog by our very own Elizabeth Bonnell!
SOLVED

Excel like ASC Function

Highlighted
7 - Meteor

Hi,

 

Is there a similar function in alteryx that can convert full-width (double-byte) characters to half-width (single-byte) characters like the ASC function in Excel?

 

For example,    "ABCDE" (double-byte)  will be converted to "ABCDE"(single-byte).

 

I have tried some of the conversion functions but it does not work.

Highlighted
11 - Bolide
11 - Bolide

Hi @steve_tang,

 

Looks like this formula will do the trick: ConvertFromCodePage([Double-Byte], 936) - also see my attached workflow for the same.

 

This page may provide further context: https://help.alteryx.com/current/CodePages.htm

 

img.JPG

 

Thanks,

Rafal

 

#Excuse me, do you speak Alteryx?

Highlighted
7 - Meteor

HI @

 

Thanks for you reply.

 

For pure english, the fomula works very well.

 

But when I add some characters with variable width like " S-line饰条,红色  " ,that will result in messy code.

 

Is there any other workaround?

 

 

Steve

 

Highlighted
17 - Castor
17 - Castor

Hi @steve_tang 

 

@rafalolbert's solution looks like the way to proceed, but I think that you need to parse your data on a character by character basis.  

 

WF.png

The formula that I used is this.  

 

if ChartoInt([Original]) >65535-256 then
	ConvertFromCodePage([Original], 936)
else
	[Original]
endif

Only apply the code page conversion if the value of the character is > (65535 - 256). I looked, unsuccessfully, for a reference that shows the unicode range for double wide characters.  I chose the top 256 of the range because it fit the sample you provided.  You may have to adjust the 256 to fit your data.  If you do manage to find the actual range, please post it back here.

 

Results

 

Results.png

 

The middle columns is the result of applying the conversion to all characters.  The last column uses the formula from above.

 

Dan

Highlighted
7 - Meteor

Hi @danilang 

 

I have slighted modified your workflow to accommodate multi-row data and adjust the unicode range start point to be 65281.

 

for unicode range between 65270-65280,  these are Arabic Presentation Forms-B that we do not care. (https://unicode-table.com/en/blocks/arabic-presentation-forms-b/)

 

Thanks for your help!

 

 

Steve

Highlighted
17 - Castor
17 - Castor

Glad to help @steve_tang 

 

Thanks for posting the correct range

 

Dan 

Labels