/// <summary> /// Returns XML string with all occurences of Active element "Column". /// </summary> /// <param name="index">index of data source in FEplugin data sources table</param> /// <returns>XML string</returns> public static string getList(int index) { string resultString = ""; // result XML string string ErrStr = ""; // error reports // loading DTD to resultString try { resultString = XMLHelper.loadDTD(); } catch (Exception e) { #if (LADENI) MessageBox.Show("error while loading DTD: " + e.Message); #endif return resultString; } // root element resultString += "<active_list>"; // processing of each box Column #region searching a processing of each boxes Column (DataMiningCommon.Column) IBoxModule[] AttrBoxes = BoxesHelper.ListBoxesWithID(CFEsourcesTab.Sources[index] as CFEsource, "DataMiningCommon.Column"); // processing of each box Column foreach (IBoxModule ABox in AttrBoxes) { try { Rec_column rColumn = new Rec_column(); // zaznam o novem sloupci // searching ID rColumn.id = "column" + ABox.ProjectIdentifier.ToString(); // searching data source name (database) IBoxModule[] db_names = BoxesHelper.ListAncestBoxesWithID(ABox, "DataMiningCommon.Database"); if (db_names.GetLength(0) != 1) // searched more than one data source or neither one throw new System.Exception("found " + db_names.GetLength(0).ToString() + " databases"); rColumn.db_name = (db_names[0].GetPropertyOther("DatabaseName") as StringT).stringValue; // searching data matrix name IBoxModule[] matrix_names = BoxesHelper.ListAncestBoxesWithID(ABox, "DataMiningCommon.DataMatrix"); if (matrix_names.GetLength(0) != 1) // searched more than one data source or neither one throw new System.Exception("found " + matrix_names.GetLength(0).ToString() + " data matrixes"); rColumn.matrix_name = (matrix_names[0].GetPropertyOther("Name") as StringT).stringValue; // searching name of column rColumn.column_name = ABox.GetPropertyString("Name"); // searching type of values rColumn.value_type = ABox.GetPropertyString("ValueSubType"); // searching Min rColumn.min = ABox.GetPropertyString("ValueMin"); // searching Max rColumn.max = ABox.GetPropertyString("ValueMax"); // searching Avg rColumn.avg = ABox.GetPropertyString("ValueAverage"); // adding item to XML resultString += rColumn.ToXML(); } catch (System.Exception e) { ErrStr += "Box ProjectIdentifier=" + ABox.ProjectIdentifier.ToString() + ": " + e.Message + "\n"; } } #endregion resultString += "</active_list>"; #if (LADENI) // Kody - storing output to file "XMLColumnExample.xml" in directory XMLHelper.saveXMLexample(resultString, "../XML/XMLColumnExample.xml"); if (ErrStr != "") MessageBox.Show("Chyby pri generating seznamu Boolskych cedent:\n" + ErrStr); #endif return resultString; }
/// <summary> /// Returns XML string with all occurences of Active element "Column". /// </summary> /// <param name="index">index of data source in FEplugin data sources table</param> /// <returns>XML string</returns> public static string getList(int index) { string resultString = ""; // result XML string string ErrStr = ""; // error reports // loading DTD to resultString try { resultString = XMLHelper.loadDTD(); } catch (Exception e) { #if (LADENI) MessageBox.Show("error while loading DTD: " + e.Message); #endif return(resultString); } // root element resultString += "<active_list>"; // processing of each box Column #region searching a processing of each boxes Column (DataMiningCommon.Column) IBoxModule[] AttrBoxes = BoxesHelper.ListBoxesWithID(CFEsourcesTab.Sources[index] as CFEsource, "DataMiningCommon.Column"); // processing of each box Column foreach (IBoxModule ABox in AttrBoxes) { try { Rec_column rColumn = new Rec_column(); // zaznam o novem sloupci // searching ID rColumn.id = "column" + ABox.ProjectIdentifier.ToString(); // searching data source name (database) IBoxModule[] db_names = BoxesHelper.ListAncestBoxesWithID(ABox, "DataMiningCommon.Database"); if (db_names.GetLength(0) != 1) // searched more than one data source or neither one { throw new System.Exception("found " + db_names.GetLength(0).ToString() + " databases"); } rColumn.db_name = (db_names[0].GetPropertyOther("DatabaseName") as StringT).stringValue; // searching data matrix name IBoxModule[] matrix_names = BoxesHelper.ListAncestBoxesWithID(ABox, "DataMiningCommon.DataMatrix"); if (matrix_names.GetLength(0) != 1) // searched more than one data source or neither one { throw new System.Exception("found " + matrix_names.GetLength(0).ToString() + " data matrixes"); } rColumn.matrix_name = (matrix_names[0].GetPropertyOther("Name") as StringT).stringValue; // searching name of column rColumn.column_name = ABox.GetPropertyString("Name"); // searching type of values rColumn.value_type = ABox.GetPropertyString("ValueSubType"); // searching Min rColumn.min = ABox.GetPropertyString("ValueMin"); // searching Max rColumn.max = ABox.GetPropertyString("ValueMax"); // searching Avg rColumn.avg = ABox.GetPropertyString("ValueAverage"); // adding item to XML resultString += rColumn.ToXML(); } catch (System.Exception e) { ErrStr += "Box ProjectIdentifier=" + ABox.ProjectIdentifier.ToString() + ": " + e.Message + "\n"; } } #endregion resultString += "</active_list>"; #if (LADENI) // Kody - storing output to file "XMLColumnExample.xml" in directory XMLHelper.saveXMLexample(resultString, "../XML/XMLColumnExample.xml"); if (ErrStr != "") { MessageBox.Show("Chyby pri generating seznamu Boolskych cedent:\n" + ErrStr); } #endif return(resultString); }