Nested hierarchy

I am trying to build multiple hierarchies, each being the previous one with one extra level.

The context is that I have some data with a 3-level hierarchy. The 1st level has 500 elements, the 2nd 5000 and the last one 6M and counting. I think I could build one hierarchy only based on the lowest level and use whichever level is relevant in my data cubes, but as I do not always use the 3rd level, I am afraid that reading 6M rows to have only 5k uniques is a massive waste of time. I already in the past had issues with text search in the hierarchy filters.

This is my top level, L1:

create table if not exists l1 (
    id serial primary key
  , name varchar(256) not null unique
)

I made a cube out of it and a hierarchy out of the cube. Easy peasy.

This is my 2nd level, l2:

create table if not exists l2 (
    id serial primary key
  , l1_id int references l1
  , cid int not null
  , name varchar(256)
  , unique (l1_id, cid)

I made a cube out of it, and promoted l1_id to the l1 hierarchy I defined just before. So far so good.

When I am trying to make a hierarchy out of this cube, l1 being top level and l2 being the 2nd level, I cannot find a way to get the name defined in the l1 hierarchy to be the caption of the l1 level. You can see that the top level only has IDs, the second level has a proper caption.
Screenshot%20from%202019-07-12%2014-41-41

Is there a way to do what I want?

Cheers,

On a side note, if for my hierarchy 1 I add the name as an attribute, I can see it when I define my hierarchy 2, in the dropdown for ‘member caption source’. But as soon as I select it, I get the error:

Error 1 of 2

Title:
The underlying data cube is invalid or incompatible due to changes in it or in its base data connector.

Details:
Web response code: 500 error (Dundas.BI.Data.DataRetrieval.InvalidDataCubeException)
   at Dundas.BI.Data.DataRetrieval.ProviderReader.get_Item(Guid elementId)
   at Dundas.BI.Data.Metadata.ExternalHierarchyLevel`2.<GetUserHierarchyMembers>d__36.MoveNext()
   at Dundas.BI.Data.MemberRetrieval.HierarchyPlanManager.ProcessUserHierarchy(UserHierarchyLevel level, MemberRetrievalOptions retrieveOptions, MembersProcessorFlags& flags)
   at Dundas.BI.Data.MemberRetrieval.HierarchyPlanManager.GetHierarchyMembers(IHierarchyMemberContainer memberContainer, IHierarchyLevel level, MemberRetrievalOptions retrieveOptions, MembersProcessorFlags& flags)
   at Dundas.BI.Data.MemberRetrieval.MemberLoader.GetMembersWithShownMembers(IHierarchyMemberContainer memberContainer, MemberRetrievalOptions options, ICollection`1 shownMembers)
   at Dundas.BI.WebApi.Controllers.HierarchyController.<>c__DisplayClass4_1.<GetMembers>b__0()
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Dundas.BI.WebApi.Controllers.HierarchyController.<GetMembers>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Threading.Tasks.TaskHelpersExtensions.<CastToObject>d__1`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__6.MoveNext()

Version: 6.0.1.1003

-------

Error 2 of 2

Title:
The given key was not present in the dictionary.

Details:
Web response code: 500 error (System.Collections.Generic.KeyNotFoundException)
   at System.ThrowHelper.ThrowKeyNotFoundException()
   at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   at Dundas.BI.Data.DataRetrieval.ProviderReader.get_Item(Guid elementId)

After speaking to our development team, they have determined that this is a bug. It will be listed as issue 80359 in the release notes.

I came back here to say the same. Thanks Cristian!