FR : l'idée est de charger une liste de dimension dans un treeview. La première méthode construit un dictionnaire de dimension pour un cube donné
EN : My Idea is to load a treenode by dimension, hierarchies ... This first method constructs a dicitionnary of dimensions for a given cube :
public Dictionary<string, string> getDimension(string p_cubeName)
{
Dictionary<string, string> m_dict = new Dictionary<string, string>();
CubeDef m_cube = this._mdConn.Cubes[p_cubeName];
foreach (Dimension dim in m_cube.Dimensions)
{
m_dict.Add(dim.UniqueName, dim.Caption);
}
return m_dict;
}
FR : ici je préfère créer une méthode séparée que j'appelle pour charger les node de sorte à ne pas mélanger accès aux données et chargement du treeview (mon idée étant d'appeler ces méthodes par remoting ou autre). Je présente ici la méthode GetDimensionTree.
EN : I prefer to create a separate method that I call to load treenodeCollection in order to mix data access and treeview loading. (this will be interesting If I decide to use remoting for example ;) or ay distributed model). Here is the node population method :
public TreeNode GetDimensionTree(string p_cubeName)
{
TreeNode m_nodes = new TreeNode("Dimension");
Dictionary<string, string> m_dim = this.getDimension(p_cubeName);
foreach (string dimName in m_dim.Values)
{
TreeNode dim_node = new TreeNode(dimName);
/* populates hierarchies for a given dimension*/
this.getHierarchyTree(ref dim_node, p_cubeName, dimName);
/* populates Hierarchy list */
m_nodes.Nodes.Add(dim_node);
}
return m_nodes;
}
FR : la méthode getHierarchyTree sera détaillée dans un autre article.
EN : the getHierarchyTree will be discussed sooner...