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

Create New Field in Script

I want to creat a new field in my table that ranks the instance of TR.REF for each SORDREF.

So, instance of TR.REF 282117 for SORDREF 142871 is 1, instance of 283479 is 2, etc as per below

DATESORDREFTR.REFITEMCODENEW FIELD
04/01/201014287128211733E01 -(222901)1
04/01/201014287128211733E10 -(222902)1
04/01/2010142871282117MTCRCA091
04/01/2010142871282117ZR5RT0111
04/01/20101428712821171722.471
04/01/2010142871283479333E - (222964)2
04/01/201014287128398117073
04/01/2010142871285213ZR5MF0114
04/01/2010142872282070100606531
04/01/2010142872282070100664011
04/01/2010142873282071100606531
04/01/2010142874282049013 - 41
04/01/20101428742820494861.0631
04/01/20101428742899432202.03152
04/01/20101428742899442202.03153
04/01/2010142875282036690 DZII1
04/01/2010142876282057BB27181
04/01/2010142876282057E2718O1
04/01/2010142877282079OBS/4863.0631


PS - am a Personal Edition user

17 Replies
pover
Luminary Alumni
Luminary Alumni

I'm not sure why you get an error by just looking at the error message. Can you post your script to investigate the source of the error?

Regards.

mazacini
Creator III
Creator III
Author

Hi Karl

Script attached.

Joe

mazacini
Creator III
Creator III
Author

Hi Karl

In fact i had commented out the Final Table section. In the meantime, I noticed that I had inserted a new LOAD statement from Custs1.csv.

In fact the script is as per attached.

Joe

johnw
Champion III
Champion III

You named the table TRANS1 then tried to refer to it as Trans1. I believe QlikView is case-sensitive.

mazacini
Creator III
Creator III
Author

Thanks John.

New Error "Field Names must be unique within table".Can you take a look?

I may be overstaying my welcome on this post, but hopefully this will be the last issue.

Joe

johnw
Champion III
Champion III

You're doing this:

Load *, DEL_COUNT

So you're telling it to load ALL fields, and then repeating DEL_COUNT. You can't load DEL_COUNT twice in the same table. If you were trying to add a field to avoid the automatic concatenation, that's not the way to do it. Instead, use noconcatenate.

Final_Table:
NOCONCATENATE
LOAD *
RESIDENT TRANS1
...

mazacini
Creator III
Creator III
Author

Hi John / Karl

The script now runs error free. I have to say I'm not sure whats going on with that part of the script. It seems to have created additional syn keys, which I also don't understand.

All things I can investigate myself in time.

Time to move on.

Thanks for all your help.

Joe

pover
Luminary Alumni
Luminary Alumni

You are probably needing a

Drop table TRANS1;

at the end of the script.