public void UpdateLookupValues() { if (LookupDataset.Length > 0) { Values.Clear(); Items.Clear(); DataInfo dinfo = Report.DataInfo[LookupDataset]; dinfo.DisConnect(); dinfo.Connect(); try { int indexvalue = 0; if (dinfo.Data.Columns.Count > 1) { indexvalue = 1; } while (!dinfo.Data.Eof) { Items.Add(dinfo.Data.CurrentRow[0].ToString()); Values.Add(dinfo.Data.CurrentRow[indexvalue].ToString()); dinfo.Data.Next(); } } finally { dinfo.DisConnect(); } } }
private void RView_BeforeExpand(object sender, TreeViewCancelEventArgs e) { // Change items inside the tree no tag assigned to the child if (e.Node.Tag is DataInfo) { if (e.Node.Nodes.Count > 0) { if (e.Node.Nodes[0].Tag == null) { RView.BeginUpdate(); try { e.Node.Nodes.Clear(); DataInfo ninfo = (DataInfo)e.Node.Tag; ninfo.Connect(); foreach (DataColumn ncolumn in ninfo.Data.Columns) { FieldInfo newinfo = new FieldInfo(ninfo, ncolumn.ColumnName); newinfo.DataType = ncolumn.DataType; if (ninfo.Data.ColumnSizes.IndexOfKey(ncolumn.ColumnName) >= 0) { // Show field size only for strings if (newinfo.DataType.ToString() == "System.String") { newinfo.fieldsize = ninfo.Data.ColumnSizes[ncolumn.ColumnName]; } } string colcaption = ncolumn.ColumnName + " - " + newinfo.DataType.ToString(); if (newinfo.fieldsize != 0) { colcaption = colcaption + "(" + newinfo.fieldsize.ToString() + ")"; } TreeNode newnode = e.Node.Nodes.Add(colcaption); newnode.Tag = newinfo; } } finally { RView.EndUpdate(); } } } } if (e.Node.Tag is Evaluator) { if (e.Node.Nodes.Count > 0) { if (e.Node.Nodes[0].Tag == null) { RView.BeginUpdate(); try { e.Node.Nodes.Clear(); Evaluator eval = (Evaluator)e.Node.Tag; Strings list = FReport.GetReportVariables(); foreach (string s in list) { TreeNode newnode = e.Node.Nodes.Add(s); newnode.Tag = new FieldInfo(null, s); } } finally { RView.EndUpdate(); } } } } }