Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have 2 tables that are very similar and I use noconcatenate to stop them associating.
After I have built the second table all I need to do is change one field name to the same as the a field in the first table and concatenate.
eg:
Table 1:
load..
ABC
inner join
etc
Table 2:
Noconcatenate
load..
ABC as ABC_S2
inner join
etc
Then I need to rename ABC_S2 to ABC and concatenate the 2 tables.
The issue seems to arise when I use 'exist' as this looks for a preloaded field and there is a conflict if there are 2 fields from seperate tables of the same name.
But first I would like to get this working then investigate further.
Not sure I understand, can you elaborate or provide the complete script highlighting the issue?
Hi Neil, you can load ABC 2 times, one for check with 'exists' and the original name:
Table 2:
Noconcatenate
load..
ABC,
ABC as ABC_S2
inner join
...
DROP field ABC_S2; //To remove the extra field used to check
You can rename field with: RENAME Field [ActualFieldName] to [NewFieldName]; but you can't use an existing field name as the new name.
I don't think you need to RENAME the field, just rename it using AS when do the final concatenate LOAD
CONCATENATE (Table1)
LOAD ABC_S2 as ABC,
...
RESIDENT Table2;
DROP Table2;
Not sure what you are telling us regarding the Exists() function, since it's missing in your code snippet.
Maybe have a look at Exists() with two arguments: Exists(Field, Expression)
Hi,
What I would like to know is, if you have 2 exists formulas in one script seperated into 2 tables, the second exist formula wont read any fields from Table1?
Table1:
Exist()
Table2:
Noconcatenate
>>Exist()
That is what exist() does.
For example, if you have
Table1:
...
ABC,
...;
Table2:
...
ABC,
...
where not exist(ABC);
The load of Table2 will exclude all records with the value that exists in column ABC loaded so far, including the values from Table1.
Neil,
could you please post your real code snippet you are using?
The above - well, 'text' - is far from valid QV syntax and does not show how you are using exists() function.
Pls elaborate more on the table structure and the goal you are trying to achieve. It appears that you do not want QlikView to do natural concatenation as well as table association (based on the same field name) so you have the ABC field renamed. But then you want to revert it back to the original field name? In this case table1 and table2 will have a common field ABC and QlikView will try to associate (link) the two tables. Are all the fields in the 2 table exactly the same?
IMHO you cannot rename a field to another field name that already exists (maybe in another resident table). Because that would mean you would try to merge two symbol tables.
Columns in two tables with the same name refer to a single field with that name. for example, if you load Table1 and you NoConcatenate Load Table2 with identical column names, if you now load a third table that checks with Exists() for existing values in one of these fields, all values from both tables will be checked.
Furthermore, if you load Table1 and then you Noconcatenate Load Table2 that has identical column names and checks for existing field values using Exists(), the exists() will check all values in the column from Table1 and all values in the identically named column of Table2 that are loaded so far. Even when the two tables are being kept separate..
Aside from that, I agree with the others that it isn't entirely clear what you're up to.
Best,
Peter
Why can't you concatenate to the original table as you reduce the fields in it. That way you have done both steps in one read. If there are other steps you are doing to table 2 you should explain your process better. If you can't do it at the same time, then swuehl has the correct answer.
eg:
Table 1:
load..
ABC
inner join
etc
Table 2:
Noconcatenate
load..
ABC
inner join
where exists(ABC)
etc