Page 1 of 1

assignment issue.

Posted: Thu Sep 01, 2011 5:42 am
by ryan
I have a cube1, cube 2.

Cube1 has dim1,dim2,dim3,Measuredim
cube2 has dim1,dimX,dim2,dim3,Measuredim

dim2 has text attribute - 'category', which contains corresponding category of the elements in dim2. dimX is a dimension which holds category as elements. Now I want to source the data(using rule)from cube1 to cube2 such that the category of dim2 matching to the elements of dimX.

dim2:
element(text Attribute-category)
---------------------------------
a1(category1)
a2(category1)
a3(category2)
a4(category2)
a5(category2)
a6(category2)
a7(category2)
a8(category3)
a9(category3)
a10(category3)


where as dimX has the following elements:
category1
category2
category3
category4
category5

my intention is (I know this below code will not work)
DB('Cube2',!dim1,ATTRS('dim2',!dim2,'Category'),!dim2,!dim3,'Nvalue')=DB('Cube1',!dim1,!dim2,!dim3,'Nvalue');

Can anyone help me in providing the solution for the above statement.

Thanks in advance.

Regards,
-Ramesh.

Re: assignment issue.

Posted: Thu Sep 01, 2011 1:53 pm
by David Usherwood
Think something like

Code: Select all

#Rule, in cube2
[] = n: if(
  attrs('dim2',!dim2,'Category') @= !Dimx,
  DB('Cube1',!dim1,!dim2,!dim3,'Nvalue'),
#else
  0);
# and feeder, in cube 1
[] => DB('Cube2',!dim1,
  'All Categories',
  !dim2,!dim3,'Nvalue');
should do it. Won't be a very small feeder though.