Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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?
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
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;
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
thank you so much! It worked.