Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik and ServiceNow Partner to Bring Trusted Enterprise Context into AI-Powered Workflows. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
eloyet
Contributor
Contributor

get field name with statement

I have 6 columns named A ,B, C, A_temp, B_temp, C_temp i need get these field names and drop fields named *_temp 

What should i do?

Labels (1)
1 Solution

Accepted Solutions
hic
Former Employee
Former Employee

Use the following in the script (but change the table name first):

For FieldNumber = NoOfFields('TableName') to 1 Step -1
Let FieldName = FieldName($(FieldNumber) ,'TableName');
If Index(FieldName,'_temp') Then
Drop Field "$(FieldName)";
End If
Next FieldNumber

View solution in original post

3 Replies
vinieme12
Champion III
Champion III

temp:
Load * inline [
a,b,c,a_temp,b_temp
];



temp2:
Load * inline [
x,y,z,y_temp,t_temp
];

For t = 0 to NoOfTables() - 1
 For f = 1 to NoOfFields(TableName($(t)))
   vfield = FieldName($(f),TableName($(t)))

   if  wildmatch('$(vfield)','*temp') then
  dropfield:
  Load 
  	'$(vfield)' as dropfields
    AutoGenerate 1;
   End if
 Next f
Next t;


for each val in FieldValueList('dropfields')
drop Field $(val);
next val
drop table dropfield;
Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
hic
Former Employee
Former Employee

Use the following in the script (but change the table name first):

For FieldNumber = NoOfFields('TableName') to 1 Step -1
Let FieldName = FieldName($(FieldNumber) ,'TableName');
If Index(FieldName,'_temp') Then
Drop Field "$(FieldName)";
End If
Next FieldNumber

eloyet
Contributor
Contributor
Author

thank you so much! It worked.