Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

creating Hierarchy : Fields Names must be unique

Hello

I'm trying to figure out what I can do with the hierarchy function but I'm unable to use it because I always get an error message

"Fields Names must be unique within table"

The load is however very simple and I can't see any duplicate field name ?

What is wrong ?

Thanks for any help

ccx:

Hierarchy(hhcompanyid,hhparentid,hhcompanyname,hhparentname)

load

hcompanyid as hhcompanyid,

hparentid as hhparentid,

hcompanyname as hhcompanyname,

hparentname as hhparentname

resident ccy;

1 Solution

Accepted Solutions
hic
Former Employee
Former Employee

Well, you do have duplicate names... but it is probably not easy to spot.

The three first parameters of the Hierarchy prefix are input parameters. The 4th is an output parameter. This means that the prefix creates a field "hhparentname" (4th parameter) when you already have a "hhparentname" in the load statement. Rename one of them, and it will probably work.

HIC

View solution in original post

3 Replies
hic
Former Employee
Former Employee

Well, you do have duplicate names... but it is probably not easy to spot.

The three first parameters of the Hierarchy prefix are input parameters. The 4th is an output parameter. This means that the prefix creates a field "hhparentname" (4th parameter) when you already have a "hhparentname" in the load statement. Rename one of them, and it will probably work.

HIC

Not applicable
Author

Thank You Henric

Indeed not easy to spot !

I did just find it before your answer after 1001th try of everything

I understand a little bit better now

BTW : Can I get another name than "Path" for the result

hic
Former Employee
Former Employee

Yes, you can use any name you want for PathName. The full syntax is

Hierarchy (NodeID, ParentID, NodeName, ParentName, PathSource, PathName, PathDelimiter, Depth)

ParentName, PathName and Depth are output parameters: Strings that are used as names for the created fields.

NodeID, ParentID, NodeName, PathSource are input parameters - fields that should exist in the Load statement.

Finally, PathDelimiter should be a literal - one single string valid for all records.

HIC