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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Creating the same number format in a field

Hi everyone

Please help, i've got a field with all cell fone numbers which i'm bringing in from an excel sheet, but they are some have different formats eg. one number will be formatted: 0117836431 (which is the format i want) and others would be formatted: 011-2345765, 011 365 2365, 011543 7896 etc. In the script, how do i make them all the same format??

1 Solution

Accepted Solutions
Not applicable
Author

dude, use purgechar function...1st to remove '-' & then to remove blank spaces.

View solution in original post

13 Replies
biester
Specialist
Specialist

Hi,

have you tried loading using text(), e.g. text(cell_fone_number)?

Rgds,
Joachim

Not applicable
Author

Ok i've just tried text(cellnumber) as cellnumber in the script, reloaded it and still get brackets and commas etc in that field, i want to try and get all the numbers to look the same...

biester
Specialist
Specialist

Hi,

then I'd additionally work with MapSubstring (see reference manual). You can list the unwanted characters and the replace string (can be blank or null) there. Thus you could eliminate brackets, commas or whatsoever.

Rgds,
Joachim

Not applicable
Author

Ok is there not something a bit simpler to use like the text function u mentioned??

biester
Specialist
Specialist

Yes, of course, you could edit the excel sheet 😉

Rgds,
Joachim

Not applicable
Author

dude, use purgechar function...1st to remove '-' & then to remove blank spaces.

Not applicable
Author

Haha, thast what i'm trying to avoid in order for it to be automated when reloaded if u know what i mean, ok what is the syntax i would use when using mapsubstring, it is a rather large field...

biester
Specialist
Specialist

varun is right, you could also use purgechar, meaning:

PurgeChar('123-456(789)' , '-()' )

would result in

123456789.

Nevertheless, if you like I can also build a demo using MapSubstring.

Rgds,
Joachim

Not applicable
Author

So i'd put

purgechar('CellPhoneNo',''-()',')()',(()',' ()',',()'') as CellPhoneNo

To get rid of all the unneccesary dashes and spaces??

Thank you very much