Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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;
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
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
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
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