Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
IMPORTANT security patches for GeoAnalytics Server available to download: READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
pnn44794
Partner
Partner

Duplicate Keys When Loadin Input Field

Hello:

I'm getting this error running the following load script and cannot determine why.  I use the exact same code in a different dashboard with different dimensions and it runs fine.  As always, any and all help is appreciated.

Here's the error text from the failed load:

Here's the code from the load script that I'm executing:

INPUTFIELD DI_DIM_SortOrder;
INPUTFIELD DI_Exp_SortOrder;

DI_CustomisableChart_Complex_Dimension:
Load
'['& DI_Dim_FieldName & ']' AS DI_Dim_FieldName // Important to use [ & ] to surround the field name!!
,RowNo() AS DI_DIM_SortOrder
;

Load * Inline
[
DI_Dim_FieldName
DM #
order_date_quarter
project_id
estimate_id
project_name
estimate_item_primary_location_name
estimate_item_network_zone
project_is_active
project_include_in_forecast
estimate_is_active
estimate_include_in_forecast
catalog_name
item_sku as sku
catalog_item_class_name
catalog_item_class_tier1
catalog_item_class_tier2
effective_item_name
effective_item_action
project_include_in_budget
estimate_include_in_budget
effective_item_name
effective_infra_order_date
effective_onetime_Costs
effective_year1_prorated_cost
effective_monthly_cost
effective_annual_cost
effective_cio_lob
effective_reporting_lob
effective_reporting_lob_2
effective_reporting_lob_3
family_name
service_name
sku_name
mycompute_sku
base_product_family
base_product_class
base_product_type
base_product
cpu_cores
cpu_sockets
memory
currentstatus
wrmid
clarityid
dq_fully_valid
]
;

// Create Expressions, you can add formating and set analysis
DI_CustomisableChart_Complex_Expressions:
Load * Inline [
DI_Exp_Label ,DI_Exp_SortOrder ,DI_Exp_Expression
CPUs ,1 ,"Num(If(Foundation_1 like '*SI', If(Foundation_2 like '*SI CPU', If(Foundation_3 like '*SI * CPU', effective_item_qty * cpu_cores))), '$#,##0;($#,##0)')"
Memory ,2 ,"Num(If(Foundation_1 like '*SI', If(Foundation_2 like '*SI MEM', If(Foundation_3 like '*SI * MEM', effective_item_qty * memory))), '$#,##0;($#,##0)')"
]

1 Solution

Accepted Solutions
petter
Partner
Partner

Row 17 and 22 in the table DI_CustomisableChart_Complex_Dimension have the same field name:  effective_item_name

If you fix this anomaly it works without a problem.

It is not very clearly documented actually that there needs to be at least one extra field in the same table as the input field and it has to be unique. Additional fields don't have to be unique though.

Look at the Example 2 in this document page and the comment saying something about it:

http://help.qlik.com/en-US/qlikview/November2017/Subsystems/Client/Content/Scripting/ScriptPrefixes/...

View solution in original post

2 Replies
petter
Partner
Partner

Row 17 and 22 in the table DI_CustomisableChart_Complex_Dimension have the same field name:  effective_item_name

If you fix this anomaly it works without a problem.

It is not very clearly documented actually that there needs to be at least one extra field in the same table as the input field and it has to be unique. Additional fields don't have to be unique though.

Look at the Example 2 in this document page and the comment saying something about it:

http://help.qlik.com/en-US/qlikview/November2017/Subsystems/Client/Content/Scripting/ScriptPrefixes/...

pnn44794
Partner
Partner
Author

Crap!!!  Peter, thank you so much for your help.  Sometimes, the obvious isn't so obvious and another set of eyes is needed.  I guess I looked at it for so long, that I just missed it.  Thank you again.  I greatly appreciate it.  I'll mark your answer as the correct response.