Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

joris_lansdaal
Contributor

not expected duplicate lines

Hi all,

There's a field called 'Omschrijving' and when this field contains "accrual" the Field TYPE_2 will be discounts_accrual and otherwise discounts.

I used the below logic that seems to work but gives me duplicate lines when the logic is true.

if(Len(SubField(Lower(Omschrijving),'accrual'))<Len(Omschrijving),'Discounts_accrual','Discounts') as TYPE_2.

Can anyone tell me why this is happening and wether there's a better way then using subfield?

regards Joris

1 Solution

Accepted Solutions
MVP
MVP

Re: not expected duplicate lines

May be this?

If(WildMatch(Omschrijving, '*accrual'*), 'Discounts_accrual','Discounts') as TYPE_2

4 Replies
MVP
MVP

Re: not expected duplicate lines

May be this?

If(WildMatch(Omschrijving, '*accrual'*), 'Discounts_accrual','Discounts') as TYPE_2

Re: not expected duplicate lines

Provide sample data may be it is due to Subfield that you use on the Logic due that it created two rows better to looking on sample data though.

Re: not expected duplicate lines

May be this

if( WildMatch(Lower(Omschrijving),'*accrual*','accrual*','*accrual'),'Discounts_accrual','Discounts') as TYPE_2


Highlighted
joris_lansdaal
Contributor

Re: not expected duplicate lines

Thanks! Wildmatch is shorter and does not duplicate!