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: 
MT4T
Creator
Creator

Issue with Script Variable

Hi any thoughts why my variable "vFieldList" i generated empty ? I have builded dynamical fieldlist table for data cleaning.

 

//Excluded columns from Drop Fields
Exclu:
Load * INLINE [
Col,
row,
    rec,
    wiersz,
    SCEFileName
    ];
 
//Get column list from a table
set vList=;
set vDelimiter=CHR(13);
 
for i = 1 to NoOfFields('tempSCE')  //-> Change to desired Table
   let vFieldName = FieldName($(i), 'tempSCE'); //-> Change to desired Table
   let vList = '$(vList)' & $(vDelimiter) & '$(vFieldName)';
next i
 
TMP:
load * inline [
    COLUMN_NAME
   $(vList)
];
 
ListBoxAuto:
noconcatenate
load 
COLUMN_NAME
resident TMP
Where NOT EXISTS(Col, COLUMN_NAME)
order by COLUMN_NAME asc;
drop table TMP;
LET vFieldList = Concat(DISTINCT COLUMN_NAME,', ');
 
DROP FIELDS '$(vFieldList)' FROM tempSCE; 
Labels (2)
1 Solution

Accepted Solutions
Sivapriya_d
Creator
Creator

Hi,

Please check if below helps
ListBoxAuto:
noconcatenate
Load Concat(DISTINCT COLUMN_NAME,',') as FieldList; //Added Concat
load
COLUMN_NAME
resident TMP
Where NOT EXISTS(Col, COLUMN_NAME)
order by COLUMN_NAME asc;

drop table TMP;

LET vFieldList = Peek('FieldList');


DROP FIELDS $(vFieldList) FROM tempSCE; //----> Removed Quotes

 
Thanks,

View solution in original post

1 Reply
Sivapriya_d
Creator
Creator

Hi,

Please check if below helps
ListBoxAuto:
noconcatenate
Load Concat(DISTINCT COLUMN_NAME,',') as FieldList; //Added Concat
load
COLUMN_NAME
resident TMP
Where NOT EXISTS(Col, COLUMN_NAME)
order by COLUMN_NAME asc;

drop table TMP;

LET vFieldList = Peek('FieldList');


DROP FIELDS $(vFieldList) FROM tempSCE; //----> Removed Quotes

 
Thanks,