Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

String to integer conversion

Is it possible to convert the format from string into integer in QV? For example my data is : PX42/ABCDEFG1234/0.222342 and i want to convert it to integer....as a number....is it possible for me??

1 Solution

Accepted Solutions
tresesco
MVP
MVP

Have a look at PurgeChar()/Keepchar().

View solution in original post

27 Replies
tresesco
MVP
MVP

Have a look at PurgeChar()/Keepchar().

Not applicable
Author

erm...what is that?i'm new for QV.....sry about that...

jagan
Partner - Champion III
Partner - Champion III

Hi,

Try like this

=KeepChar('PX42/ABCDEFG1234/0.222342', '1234567890')


LOAD

*,

KeepChar(DimensionName, '1234567890') as FormattedNumber

FROM DataSource;


Note: Replace DimensionName with your actual field name.


Regards,

Jagan.

Not applicable
Author

it gv me error in calculation dimension.....

tresesco
MVP
MVP

Those are functions.

PurgeChar('12345@#67#@', '#@') -> gives output : 123456 , simply purges the characters (second parameter from the main string(first parameter).

keepChar() -> similarly does the reverse, keeps only the characters mentioned as the second argument. For details see help.

Not applicable
Author

I tried both for PurgeChar()/Keepchar().....both also gv me error in calculation in dimension....any idea tresesco???

tresesco
MVP
MVP

What is the expected output from the your sample string 'PX42/ABCDEFG1234/0.222342' ? Do you need decimal?

jagan
Partner - Champion III
Partner - Champion III

Hi,

Do this in load script, so that it would be easier in front end.

LOAD

*,

KeepChar(DimensionName, '1234567890') as FormattedNumber

FROM DataSource;

Regards,

Jagan.

Not applicable
Author

ya i try yr purgechar and keepchar already....its both work very well for me.....then now i want to ask if i want to convert  only one character to ASCII value or a value.....izzit possible for me??

for example S is equal to 83 and P is equal to 80.....i found this on ASCII table....but if i want to do it on QV.....can??