# cube rule formation help

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

• # cube rule formation help

I have need of a rule, but have not been able to formulate correctly. I"ve abstracted the cubes, elements and dimensions to make it easier to describe.
cube1,

dimensions A,B,C,D

cube 2
dimensions A,E,C,D

elements within dimensions described by number, ie A1, A2 etc. C, in particular, has about 100 elements (months)

I want a rule cube 1 (B1, Cn, D1) = cube 2 (E1, Cn-1, D1) for all elements in A

How do I create a reference for Cn-1 for ALL n? (almost seems like a loop is needed)

Thanks for any who take the time to help!

The post was edited 1 time, last by PaulStafford ().

• Hi Paul,

depends how do you want to have dimension C elements to be ordered for your rule.
Easiest is to write 2 rules
['B1','C1','D1'] = 0
['B1','D1'] = PALO.DATA("","cube2",!'A',"E1",PALO.EOFFSET("","C",!'C',-1),"D1")
first rule handles the boundary of your "loop". Result can be 0 or anything you need.
C1 is taken here as an example and has to reflect the function used in second rule (PALO.EOFFSET in this example)
Second rule does the recursion. It uses current element of dimension A, fixed element E2,previous element of dimension C and fixed element D1

PALO.EOFFSET sorts elements how they are defined by their position within the dimension. First rule has to specify element of dimension C that is first
you can alternatively use some other functions like PALO.ESIBLING that does the sorting withing one parent element or store value of previous element for each element in its attribute table e.g.
['B1','D1'] = PALO.DATA("","cube2",!'A',"E1",PALO.DATA("","#_C","previous",!'C'),"D1")
in this case make sure the first rule has in target element of dimension C that has no attribute "previous" defined and make sure there is no endless loop in your elements relations (e.g. Cn.prev = Cn)

hope it helped

Jiri

I think with one more bit of help I can get it. I have not been able to precisely understand the notations within rules from the examples. Slow, I guess...
I am not sure about the difference between single and double quotes (eg 'B1' and "B1"), bang ( !'C') and "#_C"
I've searched the documentation but have not seen it.
• in general single quotes are used for static dimension/element names
- in are definition [ 'dimension':'element', 'element' ]
- in current member expression !'dimension'
these names are automatically updates when the dimension/element is renamed

double quotes are used as general string parameters of integrated functions like:
value("3.14")
palo.data("db_name","cube_name","elem1","elem2")

when you rename object used in double quotes you have to update rules manually
• thanks!
and the notations !C and #_C???I've searched the documentation but have not seen it.

anyone?
• the !C notation is this:

### jjunek wrote:

- in current member expression !'dimension'

"#_C" is name of attribute cube of dimension C. This is the way OLAP generates name for it.