I have a Qlik app where I am loading in many tables with the share the same field name. I want to qualify only those field names which have a match from what's already been loaded into qlikview. So I'm comparing the current field to the pre-loaded fields in each table.
I have attempted the solution however I am getting errors so I'm clearly going wrong somewhere.
Here are my attempts:
ForeachfileinFileList(vDatasource&'*.qvd') FORi = 1 toNoOfFields('file') LoadFieldName($(i),'file') asCurrentFieldName From [$(file)](qvd);
I'm not sure if your aim to qualify the matching fieldnames between multiple tables is useful - especially with an automatic routine. Of course you will avoid synthetic keys with it but I doubt that you will get a with it a well working datamodel.
For this you should know each of your fields and set all the associations explicitly and it could be that it would be better to merge some tables and other might be reduced and linked over some extra tables.
If you want to stay by a qualify-approach it's common to use following logic:
For me it made not much sense and you will need quite a lot of efforts to implement such a solution. The reason for this is you will need a load to qualify these fields - you couldn't do it after the loading with a rename-statement without getting the same error which occured here: Renaming Fields to names that already exists.
This meant you would need to load each file twice - at first only the header to get all included fieldnames and in following routines you would need to check if this fieldname occured already and if it's found a second time to add this field to a qualify-string-variable which you would use afterwards within the qualify-statement (alternatively would be to create a complete dynamical load-statement (with an Field AS Table.Field statement) on the fly within a variable and execute the afterwards).
Of course this is possible and I have done something like this more than once but it's not quite trivial and like above mentioned there would be no benefit - rather the opposite (despite from the fact that you would learn a lot).