hierarchy

MYSQL - Get all children from the parents

家住魔仙堡 提交于 2020-01-06 05:50:10
问题 I have stuck in getting all children's query where parent id greater than the customer id table test id name parent 1 test1 0 2 test2 1 3 test3 1 4 test4 2 5 test5 2 6 test6 10 7 test7 10 8 test8 6 9 test9 6 10 test10 5 11 test10 7 Currently I am using this recursive query but it shows children till the 10 parent but not able to give children of 6 and 7 and further SELECT id , parent FROM (SELECT id , parent from (SELECT * FROM test order by parent , id) testdata_sorted, (SELECT @pv := '1')

MDX Allow member set only siblings in Roles-Dimension Data

谁说我不能喝 提交于 2020-01-05 17:49:33
问题 Is it possbile to restrict a Role in Dimension Data by allowing him to see only siblings in the parent-child Hierarchy? Example Hierarchy: EMEA 100 UK 50 London 30 Southampton 20 France 50 Paris 10 Lyon 40 To see only: EMEA 100 UK 50 France 50 回答1: I've received the expected result with the following MDX statement NONEMPTY( descendants( [Dim Branch Hierarchies].[Branch Hierarchy] ,,leaves ) , ( [Measures].[GrantedHi] ,StrtoMember( "([Dim Users].[Account Name].[Account Name].["+ Username()+ "]

MDX Allow member set only siblings in Roles-Dimension Data

寵の児 提交于 2020-01-05 17:49:25
问题 Is it possbile to restrict a Role in Dimension Data by allowing him to see only siblings in the parent-child Hierarchy? Example Hierarchy: EMEA 100 UK 50 London 30 Southampton 20 France 50 Paris 10 Lyon 40 To see only: EMEA 100 UK 50 France 50 回答1: I've received the expected result with the following MDX statement NONEMPTY( descendants( [Dim Branch Hierarchies].[Branch Hierarchy] ,,leaves ) , ( [Measures].[GrantedHi] ,StrtoMember( "([Dim Users].[Account Name].[Account Name].["+ Username()+ "]

Method called by parent constructor behaves as child method

对着背影说爱祢 提交于 2020-01-05 04:12:06
问题 I am testing some polymorphism in java and my code looks like the following: class Base { int value = 0; public Base(){ System.out.println("Came Here And Value is: " + value); addValue(); } String addValue(){ System.out.println("Calling Bases' addValue and value is currently: " + value); value += 10; return ""; } int getValue(){ return value; } } class Derived extends Base{ public Derived(){ System.out.println("Calling Derived constructor and value currently is: " + value); addValue(); }

PHP Hierarchical Navigational OOP structure

非 Y 不嫁゛ 提交于 2020-01-05 04:04:25
问题 What is the best way to represent a tree navigation structure using PHP? I need to be able to track the current page location in the tree using a bread crumb trail. Parts of the tree are generated from a database such as make -> models. Each model then has the same equivalent tree branch, such as: Make > Model > (Area 1, Area 2, Area 3). Parts of the tree may change over time. Is it best to have a static class hierarchy structure or a dynamic solution where classes are re-used? Hope this has

Looping through DirectoryEntry or any object hierarchy - C#

依然范特西╮ 提交于 2020-01-04 14:23:10
问题 I am currently developing an application that use the System.DirectoryServices namespace to create a DirectoryEntry object and loop through the entire hierarchy to collect information. I do not know number of child entries for each DirectoryEntry object in the hierarchy, so I can not create a N number of nested loops to spiders through the Children property Here is my pseudo code example: //root directory DirectoryEntry root = new DirectoryEntry(path); if(DirectoryEntry.Childern != null) {

How to get top down forecasts using `hts::combinef()`?

﹥>﹥吖頭↗ 提交于 2020-01-03 05:45:06
问题 I am trying to compare forecast reconciliation methods from the hts package on previously existing forecasts. The forecast.gts function is not available to me since there is no computationally tractable way to create a user defined function that returns the values in a forecast object. Because of this, I am using the combinef() function in the package to redistribute the forecasts. I have been able to work of the proper weights to get the wls and nseries methods, and the ols version is the

How to Create Category Tree Hierarchy with Multiple Levels SQL? [duplicate]

独自空忆成欢 提交于 2020-01-03 00:54:50
问题 This question already has an answer here : How to create query from parent child hierarchy table (1 answer) Closed 2 years ago . I have a table which represents a category hierarchy and the element at top of the hierarchy has the parent id as 0. There are over 54K unique IDs in the CatID Column. Each ID can be a parent of another. The categories go 8 levels deep. The table is as the exaple below: CatID ParentID CatName 1 0 Home . . . . . . 20 1 Vehicles . . . 35 20 SUV 36 20 Motorbikes . . .

Calculate depth in a parent-child model in MySQL

蓝咒 提交于 2020-01-02 14:36:51
问题 How do I calculate a node's depth in a parent-child model under MySQL? I'll need the depth to, among other things, create the indent in my list (coded with PHP). 回答1: That depends on the actual implementation of your hierarchy in the database. If you are using nested sets model (http://mikehillyer.com/articles/managing-hierarchical-data-in-mysql/) you can retrieve the full parent-to-child path via a single select. Update : Ok, since you're going with adjacency list model I suggest to store

Build JSON Hierarchy from Structured Data

梦想的初衷 提交于 2020-01-02 07:10:13
问题 C# | .NET 4.5 | Entity Framework 5 I have data coming back from a SQL Query in the form of ID,ParentID,Name. I'd like to take that data and parse it into a Hierarchical JSON string. So far it seems to be much more of a daunting task than it should be. Since I'm using Entity the data comes back nicely to me as an IEnumerable. Now I believe I just need some form of recursion, but I'm not quite sure where to start. Any help is appreciated. Data Returns as id parentId name 1 1 TopLoc 2 1 Loc1 3 1