Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Removing garbage from field values

Hi all,

I am new to Qlikview and have been trying to incorporate a condition in my load script for a field as given below:

if(purgechar(Field,'-')='','N',Field) as Field

FROM ABC.qvd (qvd)

I need the script to display 'N' wherein the field value='-'(hyphen).

I have been going through a number of articles on this and came across the purgechar() function.Also applied the code without the function:-  if(Field='-','N',Field) as Field

Still no success!

Please help!

4 Replies
tamilarasu
Champion
Champion

Could you post your field values or attach sample file.?

marcus_sommer

Try:

if(wildmatch(Field,'*-*'), 'N', Field) as Field

if the aim is to check on this string. If you want to check if the field contained any content and isn't NULL then use:

if(len(trim(Field)) = 0, 'N', Field) as Field

- Marcus

sunny_talwar

May be you can also try this:

If(Len(Trim(PurgeChar(Field, '-'))) = 0, 'N', Field) as Field

PradeepReddy
Specialist II
Specialist II

if Field= '-', then you need to update the field with 'N'. In this case need of Purgechar() function

Try with the bellow condition

If(Len(Trim(Field)) = 0, 'N', Field) as Field