Page 1 of 1
RULES: Copying ALL measures from cube to aother
Posted: Wed Mar 28, 2012 10:26 pm
by mnasra
Hi Experts,
I have a cube for data entry- (some measures are Simple some are String)
I create a second cube with different dimensions- But same Measures-
FOr some reason- I cannot copy the String and the Numeric elements (it is either one or the other)...
here is the latest version of the rules:
['Actual' ] = N: if(dtype('DIM_Measure', !dim_Measure)@='N',
DB(Cube1, dime1 , !Dim_Measure), Continue);
['Actual' ] = S: if(dtype('DIM_Measure', !dim_Measure)@='S',
DB(Cube1, dime1 , !Dim_Measure), Continue);
Re: RULES: Copying ALL measures from cube to aother
Posted: Wed Mar 28, 2012 11:26 pm
by rmackenzie
You say that the dimensions in Cube1 and Cube2 are different. I am assuming the rules you posted are in Cube2; does the dime1 dimension exist in Cube1? If not, you can't use it in the DB() formula. You would have to reference an actual element names in the dimensions in Cube1.
Re: RULES: Copying ALL measures from cube to aother
Posted: Thu Mar 29, 2012 4:33 am
by Duncan P
Try changing the order of the N statement and the S statement.
Re: RULES: Copying ALL measures from cube to aother
Posted: Thu Mar 29, 2012 5:21 am
by lotsaram
Try
['Actual' ] =
N: DB(Cube1, dime1 , !Dim_Measure);
S: DB(Cube1, dime1 , !Dim_Measure);
You don't the IF test for DType of measure or the Continue as the N: and S: filters are already doing this for you.
Re: RULES: Copying ALL measures from cube to aother
Posted: Thu Mar 29, 2012 5:35 am
by Duncan P
I no longer have 9.5 installed but my recollection was that you could only have N then C (in that order) in the same statement. If you needed an S it had to be in a different statement and it would only work properly if the S statement was first.
This was not documented. It was just what seemed to work.
Re: RULES: Copying ALL measures from cube to aother
Posted: Thu Mar 29, 2012 2:21 pm
by mnasra
Thanks to all of you-
to rmackenzie: Yes dime1 is in both cubes
to Duncan P: changing the order of the N statement or the S Statement- Made either one work (which ever was first)
To Lotsaram: I liked your idea- I thought this is the one- But NO, Like Duncan P said, N and S in the same statement does not work (obviously N and C worked)-
I did 'sort of ' resolve my problem- Here is what I wrote:
['Actual', {num_measure1, Num_measure2'} ] = N: DB(Cube1, dime1 , !Dim_Measure);
['Actual', {String_measure1, string_measure2'} ] = S: DB(Cube1, dime1 , !Dim_Measure);
I obviously dont like it because I have to be always checking if no new measures have been added to that dimension.
Any new idea is MORE than welcome if you happen to think of something else.
Thanks
Re: RULES: Copying ALL measures from cube to aother
Posted: Thu Mar 29, 2012 2:39 pm
by Duncan P
Have you tried
Code: Select all
['Actual' ] = S: DB(Cube1, dime1 , !Dim_Measure);
['Actual' ] = N: DB(Cube1, dime1 , !Dim_Measure);
This should work as you need. The ['Actual'] = S: and the ['Actual'] = N: don't appear to interfere with each other as they are working on different datatypes.
Re: RULES: Copying ALL measures from cube to aother
Posted: Thu Mar 29, 2012 2:44 pm
by mnasra
Ducan,
Yes, I did try that one too- NO, it does not work- It applies to which ever is first.
Thanks.
Re: RULES: Copying ALL measures from cube to aother
Posted: Thu Mar 29, 2012 2:59 pm
by qml
Do you have AllowSeparateNandCRules=T in your tm1s.cfg? I'm not really sure if it also works for splitting S and N rules (documentation mentions no such thing), but it is needed if you want to split N and C rules for the same area. Might be worth a try.
Re: RULES: Copying ALL measures from cube to aother
Posted: Thu Mar 29, 2012 3:11 pm
by Duncan P
I am running version 9.5.2 and with the following rule

- rule.png (17.66 KiB) Viewed 8009 times
I get this behaviour

- cubeview.png (21.93 KiB) Viewed 8009 times
Is this the kind of behaviour you are after?
EDIT BTW I made the three parts of the rule different to be able to distinguish the behaviour in the view.
Re: RULES: Copying ALL measures from cube to aother
Posted: Thu Mar 29, 2012 3:34 pm
by mnasra
SOLVED - THANKS to all-
Yes it was the AllowSeparateNandCrules that I did not have- Thanks QML- (and by the way, it is documented)- see below
And Duncan, Yes, this is the behaviour I wanted, but I could not get it- (because I missed the config)
Also, the S statement HAS TO BE FIRST-
This parameter also effects how numeric and string rules are applied to cells. Without this parameter, the first rule statement that is encountered for a given AREA definition is applied to the cells within the scope of that definition. If any cell within the AREA definition is numeric and the rule is a string rule, then the cell is considered not rule-derived because there was a match that did not apply to the cell.
For example, consider the statements:
['1 Quarter']=s:'str_value';Not following.
['1 Quarter']=n:77;
If the AllowSeparateNandCRules parameter is not set (or is set to F), then the first rule statement will match any cell that uses ‘1 Quarter’ as one of its elements. If the cell is a string cell, the value of the cell will be set to “str_value”. If the cell is a numeric cell, the cell will not be considered rule derived, since a match was found (the first rule) but the rule itself did not apply.
If the AllowSeparateNandCRules parameter is set to T, then string cells which use ‘1 Quarter’ will be set to “str_value” and numeric cells which use ‘1 Quarter’ will be set to 77.To set the parameter to T, add the following line to Tm1s.cfg:
AllowSeparateNandCRules=T
Re: RULES: Copying ALL measures from cube to aother
Posted: Thu Mar 29, 2012 3:48 pm
by Duncan P
The config parameter affects the ability to have separate N and C statements. It does not affect the S statements or their relationship to the others. In the example I showed I have that parameter set to F. It works because the N and C expressions are on the same statement.
The S needing to be first was the reason I suggested initially that you swap the rules round. I should have explained the reason more clearly. I apologise.
Re: RULES: Copying ALL measures from cube to aother
Posted: Thu Mar 29, 2012 3:53 pm
by mnasra
Thanks Duncan,
No problem- For some 'weird' reasons, it did not work before I set the config and now it is working.
My only hope is that it behaves the same always.
