Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

Function to match two items

HI All,

I am not sure this can be done but wanted to throw it out and see if anyone can help:

The Problem:  I have two tables with Vendor Information listed and the vendor is spelled slightly different in both tables.  Is there a way to do some match, fix, or anything else to correct the issue.  Here is an example of what I am talking about:

Vendor Table 1

AEP-Energy

Vendor Table 2

AEPEnergy

In other words the Vendor name in both list is the same but spelled slightly different.  Is there any tricks out there.

David

7 Replies

Re: Function to match two items

THe easiest way is this:

I think you have a vendor code, so startting from it create a xlsx (or a table) with code and correct name.

Load that xlsx and use its name as the only one

stabben23
Honored Contributor

Re: Function to match two items

Hi David,

the purgchar('field','-') is one example.

sudeepkm
Valued Contributor III

Re: Function to match two items

You can use

1. Upper or lower functions if both the field values have same name but in different case

2. purgechar to remove cuh characters you find as a difference in between two names

3. trim for any spaces around the names

ashwanin
Valued Contributor

Re: Function to match two items

use Wildmatch function

jerem1234
Valued Contributor II

Re: Function to match two items

Another option is to do a Mapping like:

map1:

Mapping Load * Inline [

Column1,Column2

AEP-Energy, AEPEnergy

...

];

Where AEP-Energy is the text it is in and AEPEnergy is the text you want it to be. Then do an apply map when you load field like:

applymap('map1', FIELD) as FIELD

Hope this helps!

nizamsha
Valued Contributor

Re: Function to match two items

         Replace( Fileld,'-','')

or

        if it was like this mean AEP-Energy  Aep-Energy


use this one

       upper(Replace( Field,'-',''))

       Lower(Replace(Field,'-',''))

or

        use Purgechar(field,'-')

sunilkumarqv
Valued Contributor II

Re: Function to match two items

//     Rename the Field:

FieldMap:

Mapping SQL SELECT oldnames, newnames FROM datadictionary;

Rename fields using FieldMap;

// Rename the Table

Tab1:

Select * from Trans;

Rename table Tab1 to Xyz;

TabMap:

Mapping load oldnames, newnames from tabnames.csv;

Rename tables using TabMap;

// Rename the Fields

Alias ID as CustomerID;

Load * from Customer.csv;

or

Load ID as CustomerID, Name, Address, Zip, City, State from Customer.csv;

Community Browser