Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
irenebaee
Contributor
Contributor

How to delete characters between a string?

I have a long ID I would like to parse out "aud-1303258326460:" from

go_cmp-11228095158_adg-110142116117_ad-477526292803_aud-1303258326460:kwd-1094930831

which then should give me this

go_cmp-11228095158_adg-110142116117_ad-477526292803_kwd-1094930831

 

I have more variations of this, so I can't use purgechar to remove specific characters.

2 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Assuming that ":" only appears once, you could do something like:

=subfield(mystr, 'aud-', 1) & subfield(mystr, ':', 2) 

-Rob
http://www.easyqlik.com
http://masterssummit.com
http://qlikviewcookbook.com

JordyWegman
Partner - Master
Partner - Master

Hi Irene,

Assuming you have more variations, this solution would maybe fit better because you can add then in the column 'StringToBeReplaced'. MapSubString will just replace it by nothing and will therefore remove it.

mapString2Empty:
Mapping
Load * Inline [
StringToBeReplaced, Empty
aud-1303258326460:,
{other strings},
];


//Then do a MapSubstring


YourTable:
Load
    *,
    MapSubstring( 'mapString2Empty', [YourField] ) as ReplacedField
From [YourSource.qvd] (qvd)
;

 

 Jordy

Climber

Work smarter, not harder