Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
mszetyinszki
Contributor II
Contributor II

Duplicate key and the Inputfield

I have a table in my  application containing a long detailed sales history  data.

I use an inputfield to be able to simulate changes in profit by means o adjusting the GM%.

When I load the table in  older  QV  (v9) there is no issue.

I had to continue the development in a separate PC (out of server) with QV v.10 ,

When I load the script , it ends with an error :

Duplicate keys when loading  Input Field

and the applicatiom re-starts

This happend only in QV v.10.

When I delete the line with INPUTFIELD (load w/o the Inputfield),  the script runs OK in QV10 (but I cannot use inputsum of course)

1) What does that error mean and why only in a newer QV?

2) how to find the root couse of the error?

original script:

INPUTFIELD

SmartPlain.GM_DELTA;

SmartPlain:

LOAD

*

FROM

$(vDir)\EPS\SmartPlain.qvd

(qvd);

6 Replies
fosuzuki
Partner - Specialist III
Partner - Specialist III

Internally, QlikView uses all the non-inputfield fields from the table to create a composite primary key for each inputfield value. (starting in QV10)

Your error indicates that some records have the same combination of the non-inputfields.

For example a table A has the fields: X, Y, Z and W. W is declared as an Inputfield. The problem will occur if there are two or more records with the same combination of values for the fields X, Y and Z. This is because when you change one input value in field W, QlikView will not be able to correctly assign the value.

So answering your questions:

1. This problem happens only in QV10 because inputfields functioned differently in QV9.

2. You need to ensure that there are no duplicate records in the non-inputfield fields.

Hope I was able to explain it clearly...

Regards,

Fernando

Not applicable

Or you can add the result of the function RowNo() as a field to your 'SmartPlain' table. This will ensure that every row is unique once it's loaded in and avoid the error.

Jason_Michaelides
Luminary Alumni
Luminary Alumni

Fantastic explanation that really helped me just now.  Thanks Fernando!

Not applicable

Hi Fernando,

And what about my example? Could you please have a look to the attched qvw? !

fosuzuki
Partner - Specialist III
Partner - Specialist III

Hi Eleni,

Conceptually your app has the same error. Since you only created one field which was declared as an inputfield, QlikView doesn't have a non-inputfield field to create a key. You must create another field with a unique number for each row.

SergeyMak
Partner Ambassador
Partner Ambassador

Just in case,

I solved this problem by adding additional field with rowno()

RowNo() AS AddKey

Regards,

Sergey

Regards,
Sergey