Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
nihhalmca
Specialist II
Specialist II

How to remove required characters from field value

Hi All,

LOAD

   [Product],[Product Type],[Product Number],[Order],[Order Type],[Order Number] as Field

resindent table;

Here i need to remove "[Product Type],[Order Type]" from filed.

I tried purgechare, it removes [Product Type],[Order Type] and all [] and Product(i mean Product, Product from Product Number) from field as well.

Can you assist on this please.

Thanks,

Nihhal.

24 Replies
sunny_talwar

The way you have written this, it should remove it....

nihhalmca
Specialist II
Specialist II
Author

I written this to remove double commas however not working.

Replace(Replace(Replace(Field, '[Product Type]', ''), '[Order Type]', ''), ',,', ',')as NewField;

sunny_talwar

This seems to be working for me

Table:

LOAD *,

  Replace(Replace(Field, '[Product Type],', ''), '[Order Type],', '') as NewField;

LOAD * Inline "

Field

[Product],[Product Type],[Product Number],[Order],[Order Type],[Order Number]

" (delimiter is |);

Capture.PNG

Anonymous
Not applicable

  Use in following way


Replace(Replace(Field,' [Product Type],', ''),' [Order Type],' ,'') as NewField;

nihhalmca
Specialist II
Specialist II
Author

Yes i understood but my case is not working.

Actually i am doing field value like [Product],[Product Type],[Product Number],[Order],[Order Type],[Order Number] by using of concat.

'[' & concat(distinct [Field], '],[') & ']'

sunny_talwar

Why don't you use set analysis here?

'[' & Concat(DISTINCT {<Field -= {'[Product Type]', '[Order Type]'}>} [Field], '],[') & ']'

swuehl
MVP
MVP

Or if you need to handle this in the LOAD script:

'[' & concat(distinct If( not Match([Field],'Product Type','Order Type'),[Field]) , '],[') & ']'

its_anandrjs
Champion III
Champion III

Dear Nikhal,

Can you share some sample app which should clone of your app but hide the main things that you wont share it.

Regards

Anand

nihhalmca
Specialist II
Specialist II
Author

Hi Sunny,

Can we use setanalysis at back end (edit script), i think no.

Actually I have to load these values into variable and use that variable in some other load stmt.

Previous code is working if i see values in listbox however i am loading those values into variable by peek() like vVariable = peek('Field').

sunny_talwar

Stefan provided the back end alternative using if statement

Capture.PNG