Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
datanibbler
Champion
Champion

New field_name already exists? Nooo ... ?

Hi,

I'm having trouble with the  building-up of a keyfield between two tables:

I have to build in some formulas here because not all items in the tables can be linked using the same keyfield.

=> Of course i could do it all in one formula which would end up being a pretty long nested IF_construction

<=> I'd rather do this step-by-step so as to keep it understandable for others and for myself and easier manageable

=> I build my keyfield in a RESIDENT LOAD and for every new kind of items (every new variation on the keyfield_calculation I need) I

      insert one more PRECEDING LOAD.

=> In the PRECEDING LOAD I build a new keyfield and name it keyfield_v2. So afterwards, I go

      >> DROP FIELD keyfield FROM

<< and

      >> RENAME FIELD keyfield_v2 TO keyfield <<

=> The second part is where I always get an error message "New fieldname already exists" !?

Can anyone tell me why this is?

Thanks a lot!

Best regards,

DataNibbler

1 Solution

Accepted Solutions
marcus_sommer

Hi DataNibbler,

you made drop field from table which droped these field from this table but it is a key and exists within another table and therefore you couldn't rename it because the field exists - fields are in some way independent from the table in which they resides..

- Marcus

View solution in original post

5 Replies
datanibbler
Champion
Champion
Author

Oh, I think I know why ...

The fieldname > keyfield < of course exists in another table I have loaded prior to this one ... and the RENAME FIELD syntax does not let me specify which table I mean - or does it? It's not in the help_file, but then ...

marcus_sommer

Hi DataNibbler,

you made drop field from table which droped these field from this table but it is a key and exists within another table and therefore you couldn't rename it because the field exists - fields are in some way independent from the table in which they resides..

- Marcus

datanibbler
Champion
Champion
Author

Hi Marcus,

that is an explanation. But is there also a possible solution? I always try to keep my code as legible, understandable and maintainable as possible - for myself and for others. And adding block  by block onto a formula, so to speak, keeps it nice and simple. Is there a way to do that in this case?

Best regards,

DataNibbler

marcus_sommer

Hi DataNibbler,

it's difficult to say which way provides the best overview and maintainablility. Most probably I would keep the origin name for the key-field and change only the content from field but not the name and I believe that this even easier to follow as chain of dropping and renaming.

- Marcus

datanibbler
Champion
Champion
Author

Wow!

I didn't know that was possible. Okay, now it works. Again what learned 😉

I had to abandon the * and load every field explicitly because otherwise a field > keyfield < already exists, but there are only five fields, so that was doable.

Thanks a lot!