Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Trimming Data Out of Inconsistent Character Lengths

Hello All,

Any ideas on how I can cut the numbers starting with '62*' out of these multi-character length strings? the field is "The Key" in the attached qvw. There is a lot of inconsistencies in these strings, and i was hoping there was another way other than trim() or len() to determine where to start cutting. The result should look like what's found in the field "The Answer" with just 6 digits. I used the Mid() Excel function to get "The Answer". Any help would be much appreciated.

Thanks a lot!

1 Solution

Accepted Solutions
Peter_Cammaert
Partner - Champion III
Partner - Champion III

I guess you didn't try hard enough

Just add a third parameter 6 to the Mid() call. Like:

:

Mid(SubField([The Key], '/', 3), 4, 6) AS [The Answer],

:

 

You can use the same expression in an UI object as well. If you need this value as a key value, use the script version.


If you want me to upload a corrected copy of your document, just let me know.


Have a happy and healthy 2016!


Peter

View solution in original post

4 Replies
Peter_Cammaert
Partner - Champion III
Partner - Champion III

Something like this? (code to add to your load script)

:

Mid(SubField([The Key], '/', 3), 4) AS [The Answer],

:


Result:


Cut Field from Key thread198924.jpg

Best,


Peter

Anonymous
Not applicable
Author

Hi Peter,

This is super close. I just need the last character trimmed off of your result. I played with the parameters of your given functions and can't really get it to 6 digits in length (ie. 621103). However, i know i can do a resident load and use len(). If we can't get it done in one line, i'll still mark you correct. Thanks a ton and Happy New Year.

Peter_Cammaert
Partner - Champion III
Partner - Champion III

I guess you didn't try hard enough

Just add a third parameter 6 to the Mid() call. Like:

:

Mid(SubField([The Key], '/', 3), 4, 6) AS [The Answer],

:

 

You can use the same expression in an UI object as well. If you need this value as a key value, use the script version.


If you want me to upload a corrected copy of your document, just let me know.


Have a happy and healthy 2016!


Peter

Anonymous
Not applicable
Author

I guess I didn't haha. This works perfectly. Thanks again!