Excel like ASC Function
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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.
Solved! Go to Solution.
- Labels:
- Help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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
Thanks,
Rafal
#Excuse me, do you speak Alteryx?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
HI @rafalolbert
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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.
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
The middle columns is the result of applying the conversion to all characters. The last column uses the formula from above.
Dan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
May i check if there is any way we can convert half-width to full-width (both text and numbers)?
