Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Ribeiro
Specialist
Specialist

Reading two For and marking equal records

I have two script below. That read one folder imported and another exported.
I would like to update the imported table. Records that belong...

 

 

 

//Reading imported folder
For each vFileName in Filelist ('C:\Geral\importados\*.csv')
        importados:
      Load 
      KeepChar(@1, '0123456789000') as ID,
      KeepChar (@3,'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijlmnopqrstuvxzwyéÉúÚâÂÇçõÔÁáÔô/-ãóÓ ') as NomeReal,                
      '$(vFileName)' as NomeArquivoImportados
      From [$(vFileName)]
    (txt, utf8, no labels, delimiter is ',', no quotes, header is 1 lines);
      Next vFileName;
   
// Reading exported folder  
 For each vFileName in Filelist ('C:\Geral\exportados\*.csv')
   exportados:
        Load
        KeepChar(  @3, '0123456789000') as ID,
       @1 as NomeReal,          
       '$(vFileName)' as NomeArquivoEnviados
      From [$(vFileName)]
     (txt, utf8, no labels, delimiter is ',', no quotes, header is 1 lines);      
   Next vFileName;
   
   

 

 

How I would like it to be!

table importados 

idNomeRealexportados
1aa 
2b  
3c  

table exportados:

idNomeReal
1a
Neves
1 Solution

Accepted Solutions
Kushal_Chawda

@Ribeiro  try below

//Reading imported folder
For each vFileName in Filelist ('C:\Geral\importados\*.csv')
        importados:
      Load 
      KeepChar(@1, '0123456789000') as ID,
      KeepChar (@3,'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijlmnopqrstuvxzwyéÉúÚâÂÇçõÔÁáÔô/-ãóÓ ') as NomeReal,                
      '$(vFileName)' as NomeArquivoImportados
      From [$(vFileName)]
    (txt, utf8, no labels, delimiter is ',', no quotes, header is 1 lines);
      Next vFileName;
   
// Reading exported folder  
 For each vFileName in Filelist ('C:\Geral\exportados\*.csv')
   exportados:
        Load
        KeepChar(  @3, '0123456789000') as ID,
       @1 as NomeReal,          
       '$(vFileName)' as NomeArquivoEnviados
      From [$(vFileName)]
     (txt, utf8, no labels, delimiter is ',', no quotes, header is 1 lines);      
   Next vFileName;

left join(importados)
load distinct ID,
     NomeReal as exportados
resident exportados;

View solution in original post

2 Replies
Kushal_Chawda

@Ribeiro  try below

//Reading imported folder
For each vFileName in Filelist ('C:\Geral\importados\*.csv')
        importados:
      Load 
      KeepChar(@1, '0123456789000') as ID,
      KeepChar (@3,'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijlmnopqrstuvxzwyéÉúÚâÂÇçõÔÁáÔô/-ãóÓ ') as NomeReal,                
      '$(vFileName)' as NomeArquivoImportados
      From [$(vFileName)]
    (txt, utf8, no labels, delimiter is ',', no quotes, header is 1 lines);
      Next vFileName;
   
// Reading exported folder  
 For each vFileName in Filelist ('C:\Geral\exportados\*.csv')
   exportados:
        Load
        KeepChar(  @3, '0123456789000') as ID,
       @1 as NomeReal,          
       '$(vFileName)' as NomeArquivoEnviados
      From [$(vFileName)]
     (txt, utf8, no labels, delimiter is ',', no quotes, header is 1 lines);      
   Next vFileName;

left join(importados)
load distinct ID,
     NomeReal as exportados
resident exportados;
Ribeiro
Specialist
Specialist
Author

😀Thank you very much

Neves