Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
yelin_nyu
Creator
Creator

input field string transformation

I have an input field that users are supposed to input 6 letter/digit code. but users may enter strings with spaces, commas, semicolons, like below:

123456;;  , abcdef, 333444 4RTJU8,   -->messy, spaces, commas, and semicolon everywhere

how do i transform above string into something like one of following sitution (need to do this on front end)

123456,abcdef,333444,4RTJU8

123456;abcdef;333444;4RTJU8

123456 abcdef 333444 4RTJU8

no comma or semicolon at the end of the string if user entered one.

hopefully there is an esay way to approach this...

9 Replies
MayilVahanan

HI

Try like this

=PurgeChar('123456 abcdef 333444 4RTJU8','; ,,')

Hope it helps

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
fdelacal
Specialist
Specialist

can you do something more specific??

Suppouse that your field es DATA.

when you load in script you tranforme it.

load

replace(DATA,';','') AS DATA

THEN YOU CAN DO ALL REPLACES THAT YOU WANT.

REPLACE(REPLACE(DATA,';',''),',','')

ETC,

Hope that helps you... regards

yelin_nyu
Creator
Creator
Author

but the result will look like this

123456abcdef3334444RTJU8

I want it to look like

123456,abcdef,333444,4RTJU8

or

123456;abcdef;333444;4RTJU8

or

123456 abcdef 333444 4RTJU8

yelin_nyu
Creator
Creator
Author

it's an input field, so users will input bad data, I am trying to take that string and do a multiple selection.

fdelacal
Specialist
Specialist

try this

=left(PurgeChar('123456 abcdef 333444 4RTJU8','; ,,'),6) &' '&  left(right(PurgeChar('123456 abcdef 333444 4RTJU8','; ,,'),18),6)&' '&  left(right(PurgeChar('123456 abcdef 333444 4RTJU8','; ,,'),12),6)&' '& left(right(PurgeChar('123456 abcdef 333444 4RTJU8','; ,,'),6),6)

hope that helps you

MayilVahanan

Hi

Can you pls clarify, for every six character, want to add semicolon?
or something else?

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
rustyfishbones
Master II
Master II

Is the inputfield in the Qlikview document?

If so, there is not a way to validate this the way you want

rustyfishbones
Master II
Master II

Check this thread it may help you

http://community.qlik.com/message/218328#218328

yelin_nyu
Creator
Creator
Author

because after this

=PurgeChar('123456 abcdef 333444 4RTJU8','; ,,')

I will get a single string '123456abcdef3334444RTJU8' look like this, but i need to have at least one separator in betw the codes, otherwise there is no way i can to do a lookup on them.

i wanted to use input field and select in field in action to do multiple search. i realize if a user entered a string of codes other than 'acceptable format' then the code is not getting selected. that's why i want to either give the user a msg when their string is not entered properly or fix the mistake. since i can't do a loop here (or can i?), i don't know how to do this