Forum Discussion

xfgethelp's avatar
xfgethelp
New Contributor II
24 days ago
Solved

Create dynamic members using api.ReadDynamicDimensionInfo

Hi,

I'm trying to create dynamic members within a dimension using api.ReadDynamicDimensionInfo.

I created a custom table within application database. When the service runs, it creates members under the root member even when I pass the "Parent" member's name. Also, the aggregation weight is being set to 0 even when I've passed numerical values.

Table:

Dimension Library: I want the members to be created under "All_Customers"

Code:

It works when I use - CreateAndAddrelationships but not with the api mentioned above. Am I doing something incorrect?

  • Hi xfgethelp​

    I think your issue might be that you are trying to create your dimension as an inherited dynamic dimension

    This means you have to observe extensibility and parent members in your source data must conform to real members in the Dimension you are inheriting. This is the same logic for physical dimensions 

    Not too clear what your structure looks like from your screenshot but I can tell by greyed out members it is inherited 

    CreateAndAddrelationships works better here because it is an overloaded method where we can stipulate type of parent child relationship e.g real or dynamic members based on source data and what we are trying to create in onestream 

    Hope this helps

    Sam

3 Replies

  • sameburn's avatar
    sameburn
    Icon for OneStream Employee rankOneStream Employee

    Hi xfgethelp​

    I think your issue might be that you are trying to create your dimension as an inherited dynamic dimension

    This means you have to observe extensibility and parent members in your source data must conform to real members in the Dimension you are inheriting. This is the same logic for physical dimensions 

    Not too clear what your structure looks like from your screenshot but I can tell by greyed out members it is inherited 

    CreateAndAddrelationships works better here because it is an overloaded method where we can stipulate type of parent child relationship e.g real or dynamic members based on source data and what we are trying to create in onestream 

    Hope this helps

    Sam

  • xfgethelp's avatar
    xfgethelp
    New Contributor II

    Hi sameburn​ 

    Thanks for the reply. Is it fair to say that for extensibility, we need to use CreateAndAddRelationships (and cannot use api.readDynamicDimensionInfo) and that api.ReadDynamicDimensionInfo is used only to create a flat list of dynamic members under root?

    Also, I don't get why AggregationWeight cannot be set when it is one of the parameters that is being passed.

    • sameburn's avatar
      sameburn
      Icon for OneStream Employee rankOneStream Employee

      I think unless you have correct parent members and ids in your source dataset based on inherited dimension, it is safer to use CreateAndAddRelationships than api.ReadDynamicDimensionInfo. 

      In my experience we use the latter for simple use cases that don't require inheritance dependency. Both can handle hierarchical levels (not just flat hierarchy) based on your parent / child relationships in your source dataset 

      For your Aggregation query, I suspect it is your source data that might need review. In your screenshot it looks like you have a mixture of data types in that column e.g int and decimal based on decimalisation. So you might need to cast that value

      Hope this helps

      Sam