cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

create top level member in the parent-child hierarchy

ypinchuk
Explorer
1,340

Hello!

I want to create a new member of a dimension with a parent-child hierarchy established. This new member should be on the top of the hierarchy, so have no parents (<root> as a parent ID).

I tried this code in the Analytics Designer script but got an error during the runtime. I guess "<root>" isn't the correct string for this code

var parent = "<root>";
PlanningModel.createMembers("Dimension", {id: Id, description: desc,
				hierarchies:{H1: {parentId: parent,}
				})

Please advise, how should I refer to the parent node

Thanks,

Yuri

Accepted Solutions (1)

Accepted Solutions (1)

N1kh1l
Active Contributor

ypinchuk

var parent =''; //should do the trick in your code. 

I generally follow the below approach to create the members

Create a Script variable of type Planning model member. I have created MemberId

MemberId = ({id: "testid", description: "Test", hierarchies: {Audit_Trail_Hierarchy: {parentId: ''}}, properties: {Row_Source: "SAC"}});

var result = PlanningModel_1.createMembers('AUDIT_TRAIL',MemberId);
if(result)
{
Application.showMessage(ApplicationMessageType.Success,"Member Successfully Created");
}
else
{
Application.showMessage(ApplicationMessageType.Error,'Failed to create Member');
						
}

On execution it created the below member at root level

Hope this helps !!

Nikhil

ypinchuk
Explorer
0 Kudos

Oh, so it's not "root", it's ""!!!

Thank you

Marm
Explorer
0 Kudos
Hallo Nihhil, in the area of ​​the ScriptVariable (SAC Story 2.0) I can not find the type "PlanningModelMember" BR
Marm
Explorer
0 Kudos
Sorry Nikhil, Sorry, I didn't include the planning model in my script. Everything works now. Thanks.

Answers (0)