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??

27 Replies
tresesco
MVP
MVP

Use Ord(), like:

Ord('P')  gives 80

jagan
Partner - Champion III
Partner - Champion III

Hi,

Try like this

CharMap:

Mapping LOAD

Chr(RecNo() - 1) AS Char,

RecNo() - 1 AS Asciicode

AutoGenerate 256;

Data:

LOAD

DimName,

MapSubString('CharMap', DimName) as formattedText

FROM DataSource;

Note: Replace DimName with your actual field name.


Regards,

Jagan.

Not applicable
Author

Sry Tresesco disturb u again.....the Ord() function is for 1 charc only? if i have a string "abv123456"  and then i want to convert it all to ASCII code.......possible??

jagan
Partner - Champion III
Partner - Champion III

Hi Lee,

Is code posted in previous post is working?

Regards,

Jagan.

Not applicable
Author

all all work and i click it as correct ans already....^^

Not applicable
Author

mohan....i want to ask if i hv one table like below.....then i want to delete the duplicate row in the table.....can??

12345.PNG.png

Like the row with x42 x51 and x52 and twice rite? so if i want to delete it can or not??

jagan
Partner - Champion III
Partner - Champion III

HI Lee,

Try like this

If you have only one field then use

LOAD

DISTINCT Bin

FROM DataSource;

Or if you have other fields then use

Data:

LOAD

*

WHERE Flag = 1;

LOAD

If(Previous(Bin) <> Bin, 1) AS Flag;

LOAD

*

FROM DataSource

ORDER By Bin, Field1, Field2.....;

Note: Replace Field1, Field2 with your fields to prioritize and identify the first record

Regards,

Jagan.

Not applicable
Author

cannot be load the data.....can write some coding in the expression there only to delete the duplicate data instead of changing in the  script??

jagan
Partner - Champion III
Partner - Champion III

Hi,

Can you attach some sample, I didn't understand what you actually required, attach some sample and your expected output.

Regards,

Jagan.

Not applicable
Author

12345.PNG.png

The table above is i created on the QV.....n then u can see the above hv the duplicate value rite?

so i wish i can write something on the dimension parameter there with some formula or coding to delete the duplicate data....like x42 i only want 1 enough......x51 and x52 also want 1 enough already in my table.....that what i want.....so can or not if i want like this??