Count elements in hierarchical dimensions

Discussion forum for PivotCube VCL users. Common questions. Bug and problem reports

Moderator: Alex Zencovich

Count elements in hierarchical dimensions

Postby cleaner » Tue Jul 20, 2010 1:39 pm

Good day!

I'm use to Delphi 2010 + PivotCube VCL.

How to count the number of elements in a hierarchical dimension, together with nested elements?
Method
---
Code: Select all
PivotMap.Dimensions [i]. Count

---
returns the number of elements of the hierarchical dimension that are at the top level.
Method
---
Code: Select all
PivotMap.RowCellsCount

---
does not show the correct values ...

Once I know how many elements in a hierarchical dimension, how to get elements by ID?
Code
---
Code: Select all
item: = DimensionMap.Items [i];

---
allows me to apply only to top-level element

This is necessary for ABC-analysis of hierarchical dimensions.

PS: apologize if there are inaccuracies in the text - use http://translate.google.ru

Roman
cleaner
User
 
Posts: 8
Joined: Sat Jun 19, 2010 5:19 am

Re: Count elements in hierarchical dimensions

Postby cleaner » Thu Jul 22, 2010 2:46 am

This code shows the correct values. I think I can handle myself

Code: Select all
for i:=0 to PivotCube.Intf.Dimension[i_save].Count-1 do
   begin
     Memo.Lines.Add(PivotCube.Intf.Dimension[i_save].Items[i].Value+' = '+IntToStr(PivotCube.Intf.Dimension[i_save].Items[i].ChildCount));
   end;
cleaner
User
 
Posts: 8
Joined: Sat Jun 19, 2010 5:19 am

Re: Count elements in hierarchical dimensions

Postby cleaner » Thu Jul 22, 2010 3:30 am

And yet in the construction of ABC on hierarchical dimensions must be problems. For example, there is a group X, there are two elements-Y and Z. Y should be classified as A, and Z - to category C. If the hierarchy to keep - that in both categories need to create a hierarchical structure similar to the existing - that is to create in each category of X. As a result, should receive the following structure:

The structure of the measurement to the analysis:
X
-Y
-Z

The structure of the measurement after the analysis:
A
-X
- Y
B
C
-X
- Z

The more complex hierarchical structure, the harder it will then analyze the ...

I tend to think that during ABC-analysis group, you must clean up, ie convert the hierarchical dimension to the linear list. And then, if necessary, to return back.

Maybe I should not have started the ABC-analysis on hierarchical dimension
cleaner
User
 
Posts: 8
Joined: Sat Jun 19, 2010 5:19 am

Re: Count elements in hierarchical dimensions

Postby AlexZencovich » Thu Jul 22, 2010 4:41 pm

Yes, I think if you need ABC or Pareto analysis you should not use hierarchies, as it alrady grouped. Probably you may have 2 dimensions pointed to same database field, where one will by structured as hierarchy and second just a flat for ABC analysis.
Best regards,

Alex Zencovich
-------------------------------------------------------------------------------------------------------------------------------------------
www.pivotcube.com - OLAP solution for Delphi, C++ Builder and ActiveX environment
AlexZencovich
Site Admin
 
Posts: 580
Joined: Sun Jun 18, 2006 10:09 am

Re: Count elements in hierarchical dimensions

Postby cleaner » Sun Jul 25, 2010 1:53 am

Thank you for your reply, Alex!

I'll try to do so:

1. I would build a hierarchical dimension
2. Before the ABC-analysis will convert the hierarchical dimension to flat list (I'll create a copy ClientDataSet hierarchical dimension, remove from the group, and tell PivotCube, that used to construct the cube to the second ClientDataSet)
3. When you delete ABC-analysis of the reverse is true first ClientDataSet

PS: I have a question - why you are using the method of ABC-analysis (method of averages?) Are not always allocated group A? And yet - how to make the measurement of inactive elements are not considered in the analysis - delete these items?
cleaner
User
 
Posts: 8
Joined: Sat Jun 19, 2010 5:19 am

Re: Count elements in hierarchical dimensions

Postby cleaner » Sun Jul 25, 2010 4:52 am

I figured out why the group A there:) The method of averages, it is the same method for the differential - provides a very small group of A.
Excerpt:
"The basis of the differential method is based on the average factor for all sites. Those objects for which the factor is 6 times more than the average factor for all objects belong to group A. The group C includes those items, the factor by which to 2 or more times less than the average factor for all sites. The other objects are in the group B. It is the most common factors, there are other variations on them. In practice, the differential method gives too small a group A and a large group of S. "
cleaner
User
 
Posts: 8
Joined: Sat Jun 19, 2010 5:19 am

Re: Count elements in hierarchical dimensions

Postby cleaner » Sun Jul 25, 2010 5:42 am

"The disadvantage of this method in the selection of uncertainty factors, often leads to incorrect results. There are times that of the objects to be analyzed in general impossible to distinguish a group A. The advantage of this method is the prostate, but on the background of the shortcomings, it reduces to a minimum. In connection with this application of the differential method in practice is limited."
cleaner
User
 
Posts: 8
Joined: Sat Jun 19, 2010 5:19 am

Re: Count elements in hierarchical dimensions

Postby AlexZencovich » Tue Jul 27, 2010 5:37 am

cleaner wrote:And yet - how to make the measurement of inactive elements are not considered in the analysis - delete these items?


There is a flag in the dimension editor, which belongs to how to operate with inactive (empty) items - mark as invisible, delete automatically or leave as disabled. You may set it to delete so when cube built it will scan over the dimensions and if it set to deleted - it will delete empty items.
If you need only handle the items not belonging to your groups, you may set item.Active to disDisabledso it will not show in left pane of dimension editor etc.
Best regards,

Alex Zencovich
-------------------------------------------------------------------------------------------------------------------------------------------
www.pivotcube.com - OLAP solution for Delphi, C++ Builder and ActiveX environment
AlexZencovich
Site Admin
 
Posts: 580
Joined: Sun Jun 18, 2006 10:09 am

Re: Count elements in hierarchical dimensions

Postby cleaner » Tue Jul 27, 2010 2:40 pm

So what we need!

Thank you!
cleaner
User
 
Posts: 8
Joined: Sat Jun 19, 2010 5:19 am


Return to PivotCube VCL

Who is online

Users browsing this forum: No registered users and 5 guests

cron