Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Excel like ASC Function

steve_tang
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.

6 REPLIES 6
rafalolbert
ACE Emeritus
ACE Emeritus

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?

steve_tang
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

 

danilang
19 - Altair
19 - Altair

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

steve_tang
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

danilang
19 - Altair
19 - Altair

Glad to help @steve_tang 

 

Thanks for posting the correct range

 

Dan 

kohsim
5 - Atom

May i check if there is any way we can convert half-width to full-width (both text and numbers)?

Labels