Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
qlikmark1990
Contributor III
Contributor III

Change and delete fieldnames, based on another table

I tried to program a filter in my QlikView application to manipulate the data while loading from the data source. The source can't be adjusted and there are some known issues with the data which are described in a separate Excel file. The content of this Excel sheet is:

    

sheetveldactiewaarde-inwaarde-uit
NAWzoeknaamdelete010100WE-490null
NAWzoeknaamdelete011214TE-30null
NAWzoeknaamdelete021214EN-31null
NAWzoeknaamdelete031214TE-27null
NAWzoeknaamdelete170600TE-580null
NAWzoeknaamwijzig010160EN-32-0010160EN-32
NAWzoeknaamwijzig011166VE-168-011166VE-168
NAWzoeknaamwijzig050573VE-793-050573VE-793

sheet is the file name that needs to be adjusted.

veld is fieldname to be adjusted

actie is action (delete = delete, wijzig = change)

waarde-in is the orginal value and waarde-uit is the correct value.

If the field 'zoeknaam' in the table 'NAV' has the values 010100WE-490, 011214TE-30, 021214EN-31, 031214TE-27 or 170600TE-580, the complete row needs to be deleted. If the field 'zoeknaam' has the values 010160EN-32-0, 011166VE-168- or 050573VE-793-, the need to be adjusted as described in 'waarde-uit'

So far, my code is :

Aanpassingen_data:

LOAD sheet, veld, actie, [waarde-in], [waarde-uit]

FROM [Aanpassingen data.xlsx] (ooxml, embedded labels, table is Blad1);


TestNAV:

LOAD zoeknaam as zoeknaamTest, geslacht as geslachtTest, H_PC as H_PCTest, geboortedatum as geboortedatumTest, land as landTest]

FROM [$(vExcelPath)171220 NAW.xls] (biff, embedded labels, table is [first sheet$])

Where not exists ([waarde-in], zoeknaam) and Match(actie, 'delete');


But I recieve the error:


Field not found - <actie>

TestNAV:

LOAD zoeknaam as zoeknaamTest, geslacht as geslachtTest, H_PC as H_PCTest, geboortedatum as geboortedatumTest, land as landTest]

FROM (biff, embedded labels, table is [first sheet$])

Where not exists ([waarde-in], zoeknaam) and Match(actie, 'delete')

When I remove the Match() function I don't receive an error but all of the records described in 'Aanpassingen_data' are deleted and I just want to delete the first 5 records and change the other three.

4 Replies
marcus_sommer

I think I would try something like this:

MapAanpassingen_data:

Mapping LOAD [waarde-in], [waarde-uit]

FROM [Aanpassingen data.xlsx] (ooxml, embedded labels, table is Blad1)

where actie <> 'delete';


TestNAV:

LOAD

     applymap('MapAanpassingen_data', zoeknaam, zoeknaam) as zoeknaamTest,

     geslacht as geslachtTest,

     H_PC as H_PCTest,

     geboortedatum as geboortedatumTest, land as landTest]

FROM [$(vExcelPath)171220 NAW.xls] (biff, embedded labels, table is [first sheet$])

Where len(applymap('MapAanpassingen_data', zoeknaam, null())) >= 1;

- Marcus

qlikmark1990
Contributor III
Contributor III
Author

Thank you for this helpful answer, the problem that I have is that I only get three records in TestNAV:

     

geboortedatumTestgeslachtTestH_PCTestlandTest]zoeknaamTest
01-01-1960manHA0 2HHVerenigd Koninkrijk010160EN-32
01-11-1966vrouw3812 DCNederland011166VE-168
05-05-1973man7603 GANederland

050573VE-793

What I need to have is all records, except the 5 ones that are in error (delete). And the 3 ones shown above.

marcus_sommer

If I look on your example I thought this was the aim - 8 records overall and 5 ones with 'delete' and therefore 3 records remain or was something else meant?

- Marcus

qlikmark1990
Contributor III
Contributor III
Author

All records except the 5 ones was the idea and the three records changed.