Page 1 of 1

External Cube Reference issue

Posted: Sat Dec 01, 2012 8:17 am
by l_stoker
Good Morning,

I'm sure i'm overlooking something here, so forgive me if it is obvious, but the more i look at this the more annoyed i get and less clear are my thoughts.

I have a budget cube with a year dimension which i want to pull into an actuals cube that has a month dimension with quarter and year consolidations.

['Budget','Hours']=N:
DB('Project Budgets', !Project,!ProjectTask, !ProjectExpType, '2013', DB('}ElementAttributes_Project',!Project,'EWOVersion') ,'Budget','Hours');

If i use the above, the rule returns the budget values correctly. However hard coding a year is not ideal, so i want to replace 2013 with

DB('ProjectPhasing',!ProjectPeriod,'Yearlookup')

but when i do this no values are returned.

If i write the following rule in another cell, just to see what is returned, then i get 2013

['Budget','6026','JAN-13','Costs']=DB('ProjectPhasing',!ProjectPeriod,'Yearlookup');

Any ideas why this won't work?? Is there a data mismatch or am i missing something fundamental?

Many thanks
Lee

Re: External Cube Reference issue

Posted: Sat Dec 01, 2012 8:28 am
by Steve Rowe
Is the cell you are storing your year in a string? If not then change it to a string or apply the str formula to your DB ref.

HTH
Cheers

Re: External Cube Reference issue

Posted: Sat Dec 01, 2012 10:03 am
by l_stoker
Legend!! Appreciate your guidance on this.
Lee

Re: External Cube Reference issue

Posted: Sat Dec 01, 2012 3:42 pm
by Duncan P
Normally if you use a string in a numerical context, or a number in a string context (such as here) the rule compiler gives an error. However because DB can return either strings or numbers, according to what its inputs are, the compiler has no way of telling that you have made a mistake. What happens at runtime is that if the context is numeric and the source is a string it returns 0 and if the context is string and the source is numeric it returns the empty string.