Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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,
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
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