Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Kohli
Contributor

TRIM(IF(SubField(BUYER,' ',1)='Mr.',REPLACE(BUYER,'Mr.',''),

Can you please explain the meaning for it:: TRIM(IF(SubField(BUYER,' ',1)='Mr.',REPLACE(BUYER,'Mr.',''),

    IF(SubField(BUYER,' ',1)='Mrs.',REPLACE(BUYER,'Mrs.',''),

    IF(SubField(BUYER,' ',1)='Ms.',REPLACE(BUYER,'Ms.',''),BUYER)))) AS BUYER,

2 Replies
ali_hijazi
Honored Contributor

Re: TRIM(IF(SubField(BUYER,' ',1)='Mr.',REPLACE(BUYER,'Mr.',''),

subfield(column,delimer,1)

if the value of column is ABC EFG then the above function used as follows subfield(column_name, ' ',1) returns ABC

subfield_column_name, ' ' ,2) returns EFG

then the script is checking if the returned part contains Mr. or Ms. then replace these with empty string

big_dreams
Contributor III

Re: TRIM(IF(SubField(BUYER,' ',1)='Mr.',REPLACE(BUYER,'Mr.',''),

Here you are Removing Mr. or Mrs. or Ms. from your data.

Subfield(Buyer,' ',1) -> return 1st value from Buyer field before space.

Regards,

Community Browser