Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
QlikWorld 2020: Join us May 11 - 14, 2020 in Phoenix, AZ. Register early and save $400. Learn More
Highlighted
tester_sogeti
Contributor

Delete and Give Name Fields (rename, alias..)

Hi QV experts!

I am trying to do something in the load script but it seems that i am missing something.. hope that you can help me out. I will give you a simplified version of my problem.

I have a field A and a field B in the same table.

I want to delete the field A and rename the field B as A.

What i do is:

Drop A;

Rename B to A;

This doesn't give error but,  below, the code uses the field A for some calculations (I want this field A to have the values of the field B, this is why i do the name change). And at this point the error comes out.    Field Not Found - <A>

How could i solve it!?

Thanks!!

1 Solution

Accepted Solutions
tester_sogeti
Contributor

Re: Delete and Give Name Fields (rename, alias..)

Thanks to everyone for the help and the interest. I dont really understand why, as the script is huge and messy (someone made it a long time ago and no one at my company fully understands it). Nevertheless i came p with something that worked out:

-I created a new table with the sa<ame fields as the old one, i deleted the old one, did the change in the new one and then rename it as the old one. Here it is:

#TABLE:

     Load *

Resident TABLE;

Drop table TABLE;

Drop field A from #TABLE;

Rename Field B To A;

Rename Table #TABLE To TABLE;

Thanks for the help!

View solution in original post

5 Replies
vishsaggi
Esteemed Contributor III

Re: Delete and Give Name Fields (rename, alias..)

Why don't you do this?

LOAD A,

           A AS B

FROM yoursourceTable;

Drop A;

mdmukramali
Valued Contributor III

Re: Delete and Give Name Fields (rename, alias..)

Hi,

Try

Load

B as A

from -----------------------;

MVP & Luminary
MVP & Luminary

Re: Delete and Give Name Fields (rename, alias..)

Could you post the actual script or a part of the document log that shows the code you are using?

-Rob

Re: Delete and Give Name Fields (rename, alias..)

When you try to rename B into A, fields A and B are only present in this single table? And there isn't already a field called B in that table?

It seems to work for me:

Delete and give name fields thread282153.jpg

RawData:

LOAD ID, A, A*2 AS B INLINE [

ID, A

1, 5

2, 7

3, 11

4, 2

5, 20

];

DROP Field A;

RENAME Field B TO A;

ProcessedData:

NOCONCATENATE

LOAD ID, A / 100.0 AS Percentage

RESIDENT RawData;

tester_sogeti
Contributor

Re: Delete and Give Name Fields (rename, alias..)

Thanks to everyone for the help and the interest. I dont really understand why, as the script is huge and messy (someone made it a long time ago and no one at my company fully understands it). Nevertheless i came p with something that worked out:

-I created a new table with the sa<ame fields as the old one, i deleted the old one, did the change in the new one and then rename it as the old one. Here it is:

#TABLE:

     Load *

Resident TABLE;

Drop table TABLE;

Drop field A from #TABLE;

Rename Field B To A;

Rename Table #TABLE To TABLE;

Thanks for the help!

View solution in original post