Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Add an Field to identify diferent Values

Hello,

i hope anyone can help me.

I have to load a Table with no possible unique key. So i want to add a field during the load script to make the loaded data unique.

example:

Original Tabel on SQL-Server

idcalculationID
1124
1122
1123
2524
2525

Now i want to ad a field to identify the difernt calulationID's. The added nummbers should be in order to the calculationID.

expectet Result in QlikView:

idcalculationIDnewFieldId
11241
11223
11232
25242
2525

1

Is there any idea how to manage this?

thx for help!

werner

1 Reply
Not applicable
Author

Hi Werner,

try this one.

org:
LOAD * INLINE [
id, calculationID
1, 124
1, 122
1, 123
2, 524
2, 525
];


new:
LOAD
*
, IF(ISNULL(PEEK(id)), 1, IF(id=PEEK(id), PEEK(newFieldId)+1, 1)) AS newFieldId
;
NOCONCATENATE
LOAD
id
, calculationID
RESIDENT org
ORDER BY id Asc, calculationID Desc;
DROP TABLE src;

Regards

Michael