dbTalk Databases Forums  

Creating a Function to obtain the "First Common Parent" between two Leaves

microsoft.public.sqlserver.olap microsoft.public.sqlserver.olap


Discuss Creating a Function to obtain the "First Common Parent" between two Leaves in the microsoft.public.sqlserver.olap forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Miguel G.
 
Posts: n/a

Default Creating a Function to obtain the "First Common Parent" between two Leaves - 01-08-2004 , 10:48 AM






Hello All,

I have some problems developing a function in order to obtain
information I need from my cube. Does anybody know how to code a
function that would do the following:

Retrieve the member of a given dimension that responds to a certain
boolean criteria, and is the direct child of the first common parent
in a certain hierarchy of the current member and another member in
this dimension given as parameter.

For instance, let's imagine this virtual function with the following
parameters :

GetMemberByCriteria(MemberParameter, Dimension, Hierarchy, Criteria)

LEt's take a dimension named "Geography" with only one Hierarchy (H1)
that represents the countries of the world in the following form:
"World" -> "Continent" -> "Nations Organisation" -> "Country"

The criteria property named "contact" means "is the contact country
for this branch/level of the hierarchy?" (contains Y or N for each
country).

We have : GetMemberByCriteria(France, Geography, H1, contact)

- if the currentmember is Spain, the result is Belgium (contact
country for the Organization "European Community")

- if the CurrentMember is Russia, the result is Switzerland (Contact
country for Continent "Europe")

- if the CurrentMember is Australia, the result is USA (Contact
country for "World")

- if there is no commom parent (for some unexplainable reason, we
return "" or Null...

I have been working on this for my company for a while and can't get
around to find the solution. If you have any suggestions as to what
code I might use for such a function, I'd be most happy to hear from
you

Thanks in advance for reading so far, and even more if you can help me
out !
Miguel

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.