Hi, Jaqueline!

@Sam Duncan is right below, and please don't consider my example above!

See the updated version of the method for Cube class:

classmethod UnitLevel(unitID, level) as %String {

s unit=##class(Police.Unit).%OpenId(unitID)

if '$IsObject(unit) return ""

return $Case(level,

  1:unit.UNI_PADRE.UNI_PADRE.UNI_PADRE.%Id(),

  2:unit.UNI_PADRE.UNI_PADRE.%Id(),

  3:unit.UNI_PADRE.%Id(),

  4:unit.%id(),:"") }

Introduce the dimension with 4 levels, with expressions:

1 st level:

%cube.UnitLevel(%source.%ID,1)

2nd level:

%cube.UnitLevel(%source.%ID,2)

3 and 4 levels same idea.

AND!!! The key thing!

introduce a calculated or direct field in your class which will indicate a level of the row - say H_LEVEL with values 1,2,3,4 according to the level of administration.

and introduce a build restriction to the cube with:

H_LEVEL=4

So, there would be only 4th level records in the cube, but you'll gather all other needed calculations and values using your hierarchy.

Hi, Jaqueline!

Really interesting task. Do you have only 4 levels?

If so, you can introduce a method on a cube which would return a level of the unit.

Say:

classmethod UnitLevel(unitID as %Integer) as %String {

 s unit=##class(Police.Unit).%OpenId(unitID)

 if unit.UNI_PADRE="" return "Zone"

s padre=##class(Police.Unit).%OpenId(unit.UNI_PADRE)

if padre.UNI_PADRE="" return "Prefecrure"

/// continue here!

}

It's for 2 levels,  leave other two for you ;)

And use

%cube.UnitLevel(%source.UNI_CODIGO)

for the Dimension level expression.

Updated the agenda for the meetup - the new session by @Sergei Shutov has been introduced: 

Automatically configure a customized development environment. 

The session covers the approach and demo of creating a private development environment from source control, and how changes can be automatically pushed downstream to build and test environments. Show the use of open source Git hooks, %Installer, and Atelier, with Jenkins and automated Unit Tests.