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: 
Meg00
Contributor III
Contributor III

Trim field value

Hi!

I'm struggling finding the right combo of functions to get this right.

I want to trim my object Id field below to only present the actual object Id, so I wish to trim away the string "Document\".

The problem is this field contains a combination of "Document\[Object Id]" and just clean object Ids.

Does anyone have a suggestion on how to do this? 

image.png

1 Solution

Accepted Solutions
piri1069
Contributor II
Contributor II

Is "Document\" the only string you are stripping? If so, I would use the following in the load script:
If(WildMatch([Object Id],'Document\*'),Trim(Mid([Object Id],10,20)),[Object Id])

WildMatch([Object Id],'Document\*') - The Wildmatch function looks for 'Document\' in the row (I forget if '*' or '%' is the correct wildcard character)

Trim(Mid([Object Id],10,20)) - Mid function will let you get data from a designated character. Since 'Document\' is a known quantity, we can start the string after the last character. if the length of the following text is known, you could just put that quantity in placed the 20 characters i noted. I enclosed the script in a TRIM function to clean out any extra spaces .

hope this helps
Pedro

View solution in original post

3 Replies
piri1069
Contributor II
Contributor II

Is "Document\" the only string you are stripping? If so, I would use the following in the load script:
If(WildMatch([Object Id],'Document\*'),Trim(Mid([Object Id],10,20)),[Object Id])

WildMatch([Object Id],'Document\*') - The Wildmatch function looks for 'Document\' in the row (I forget if '*' or '%' is the correct wildcard character)

Trim(Mid([Object Id],10,20)) - Mid function will let you get data from a designated character. Since 'Document\' is a known quantity, we can start the string after the last character. if the length of the following text is known, you could just put that quantity in placed the 20 characters i noted. I enclosed the script in a TRIM function to clean out any extra spaces .

hope this helps
Pedro
Meg00
Contributor III
Contributor III
Author

Thank you, worked like a charm, also great explanation!

/M

yassinemhadhbi
Creator II
Creator II

Good Morning,

If i well understood your problem you probably need to

 

Right([Object Id],len([Object Id])-9)

Best Regards
Yassine Mhadhbi