Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
can I covert ASCII code from a table to char in QLIK Sense?
Example:
ASCII Code: 116101115116 should convert to "test".
Hi,
Maybe can you try something like below.
CharMap:
Mapping LOAD
RecNo() - 1 AS Asciicode,
Chr(RecNo() - 1) AS Char
AutoGenerate 256;
Data:
LOAD *,
MapSubString('CharMap', Num) as formattedText
Inline
[
Num
116101115116
]
;
Thanks,
Mohammed Mukram
Your mapping-table is wrong because you used chr() for both the lookup and the return value. It should look like:
Mapping LOAD
RecNo() - 1 AS Asciicode, Chr(RecNo() - 1) AS Char
AutoGenerate 256;
- Marcus
In general it's possible but without some further data/information like a delimiter between the numbers it could be quite difficult because the chars could have two or three digits and you would need multiple loops to approach the approximately string/value.
- Marcus
Hi,
Maybe can you try something like below.
CharMap:
Mapping LOAD
RecNo() - 1 AS Asciicode,
Chr(RecNo() - 1) AS Char
AutoGenerate 256;
Data:
LOAD *,
MapSubString('CharMap', Num) as formattedText
Inline
[
Num
116101115116
]
;
Thanks,
Mohammed Mukram
Hi
I use now this code, but I get no char back. (the [Name] is the row with the ASCII Code.
Tabelle1]:
LOAD
[ID],
[Name],
[Preis]
FROM [lib://Mist/ascii.xlsx]
(ooxml, embedded labels, table is Tabelle1);
CharMap:
Mapping LOAD
Chr(RecNo() - 1) AS Asciicode,
Chr(RecNo() - 1) AS Char
AutoGenerate 256;
DATA:
LOAD [Name],
MapSubString('CharMap', Name) as formattedText
FROM [lib://Mist/ascii.xlsx]
(ooxml, embedded labels, table is Tabelle1);
The below suggested mapsubstring-approach is surely a good starting-point but if your ASCII didn't contain just simple string-values else line-breaks, (multiple) spaces, tabs or other special chars you might not get the expected results. Therefore you should look for a delimiter and maybe there is already one not visible within the ASCII (a check with notepad++ would be useful) or this information exists within another field.
- Marcus
Your mapping-table is wrong because you used chr() for both the lookup and the return value. It should look like:
Mapping LOAD
RecNo() - 1 AS Asciicode, Chr(RecNo() - 1) AS Char
AutoGenerate 256;
- Marcus