Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
cbaqir
Specialist II
Specialist II

Wildmatch and Replace

DOC_VALUE_STRING can contain options like "Pt. requires dialysis or plasmapheresis for the following number of days X" where X is a number 1-14. Currently the script parses out the X correctly.

However, DOC_VALUE_STRING can contain options like "Other: free text". Sometimes this free text is a number or a date so it gets parsed out to DOC_VALUE_NUM but it should not be.

I need to get rid of the option in the legend that are not 1-14. Ideally when creating the QVD, the entire free text option that starts with "Other: ***" would just be replaced with a DOC_VALUE_STRING of Other: and there would be no trailing non-number. However, short of recreating the QVD, can I clean up both DOC_VALUE_STRING to lump all Other: options together and remove anything that is not 1-14 from DOC_VALUE_NUM?

Something like this:  if(wildmatch(DOC_VALUE_NUM,1, '1','2','3','4','5','6','7','8','9','0') > 0 ,'Other',DOC_VALUE_NUM) as DOC_VALUE_NUM,
if(wildmatch(DOC_VALUE_STRING,'Other;*'),'Other',DOC_VALUE_STRING) as DOC_VALUE_STRING,

2 Replies
marcus_sommer

You could check with index() if "Others: " exists and then if there are any numbers assigned respectively following and applying any replacements/extractings with replace/keepchar/purgechar or similar functions and/or deducing any flag-values from it.

But I think I wouldn't apply such measures on the origin field else I would rather split it with:

table: load
KEY,
subfield(Field & ',', ',', iterno()) as FieldPart,
iterno() as FieldPartNumber
from Source while iterno() <= substringcount(Field, ',');

and based on this the above mentioned measures should be easier to apply and I think to construct the data in this way will have many more benefits.

- Marcus

Brett_Bleess
Former Employee
Former Employee

Cassandra, did Marcus' post help you get what you needed?  If it did, please be sure to give him credit by using the Accept as Solution button on his post.  If you did something different, consider posting that and then use the button to mark that post as the solution.  If you still need help with things, leave an update.

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.