예제 #1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            QVField field = new QVField();

            field.Name = this.comboBoxFields.SelectedValue.ToString();

            if (string.IsNullOrWhiteSpace(this.txtExpression.Text))
            {
                for (int i = 0; i < this.dataGridView1.SelectedRows.Count; i++)
                {
                    FieldValue value = this.dataGridView1.SelectedRows[i].DataBoundItem as FieldValue;
                    field.Values.Add(value);
                }
            }
            else
            {
                field.Expression = this.txtExpression.Text.Trim();
            }

            if (this.FieldAdded != null)
            {
                this.FieldAdded(field);
            }

            this.Close();
        }
예제 #2
0
 void selection_FieldAdded(QVField obj)
 {
     if (FieldCollection.ContainsKey(obj.Name))
     {
         FieldCollection.Remove(obj.Name);
     }
     FieldCollection.Add(obj.Name, obj);
     this.RefreshFieldDataGrid();
 }
예제 #3
0
        void selection_FieldAdded(QVField obj)
        {
            Filter filter = this.ReportItem as Filter;

            if (filter.Fields.ContainsKey(obj.Name))
            {
                MessageBox.Show("The same name field exists, cannot add.");
                return;
            }

            filter.Fields.Add(obj.Name, obj);
        }
예제 #4
0
 protected void FieldDelete(QVField field)
 {
     if (field == null)
     {
         MessageBox.Show("Please select an field.");
         return;
     }
     if (MessageBox.Show("Do you want to delete the field " + field.Name, "Delete", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
     {
         Filter filter = this.ReportItem as Filter;
         filter.Fields.Remove(field.Name);
     }
 }
예제 #5
0
        private void button3_Click(object sender, EventArgs e)
        {
            List <string> list = this.GetFieldList();

            QVField field = this.GetQVFieldByName("Visits");
        }
예제 #6
0
        private ObservableCollection <FieldValue> GetValuesFromExpression(QVField item)
        {
            ObservableCollection <FieldValue> values = new ObservableCollection <FieldValue>();

            if (item.Name == "TheYear" || item.Name == "MonthOfYear" || item.Name == "DayOfMonth")
            {
                var valuelist = Functions.GetDateValueFromExpression(item.Expression);

                foreach (var value in valuelist)
                {
                    values.Add(new FieldValue()
                    {
                        IsNumeric = true,
                        Number    = value,
                        Value     = value.ToString()
                    });
                }
            }
            else if (item.Name == "YearMonth" && item.Expression.Contains("CurrentFiscalYearMonthEx"))
            {
                values = Functions.GetValuesFromCurrentFiscalYearMonthEx();
            }
            else if (item.Name == "YearMonth" && item.Expression.Contains("CurrentFiscalYearMonth"))
            {
                values = Functions.GetValuesFromCurrentFiscalYearMonth();
            }
            else if (item.Name == "YearMonth" && item.Expression.Contains("LatestTwoFiscalYearMonth"))
            {
                values = Functions.GetValuesFromLatestTwoFiscalYearMonth();
            }
            else if (item.Name == "YearMonth" && item.Expression.Contains("CurrentYearMonthNumeric"))
            {
                values = Functions.GetValuesFromCurrentYearMonthNumeric();
            }
            else if (item.Name == "YearMonth" && item.Expression.Contains("CurrentYearMonth"))
            {
                values = Functions.GetValuesFromCurrentYearMonth();
            }
            else if (item.Name == "FiscalYearName" && item.Expression == "CurrentFiscalYearName")
            {
                values = Functions.GetCurrentFiscalYearName();
            }
            else if (item.Name == "FiscalYearName" && item.Expression == "PreviousFiscalYearName")
            {
                values = Functions.GetPreviousFiscalYearName();
            }
            else if (item.Name == "UsageYearMonth" && item.Expression.Contains("LastMonthFiscalYearMonth"))
            {
                values = Functions.GetValuesFromLastMonthFiscalYearMonth();

                var field = this.GetQVFieldByName(item.Name);

                foreach (var value in values)
                {
                    value.IsNumeric = field.Values.First(x => x.Value == value.Value).IsNumeric;
                    value.Number    = field.Values.First(x => x.Value == value.Value).Number;
                }
            }
            else
            {
                var field = this.GetQVFieldByName(item.Name);
                List <ExpressionCondition> conditions = DateFunctions.CalculateExpression(item.Expression);

                foreach (var value in field.Values)
                {
                    DateTime date = DateTime.Parse(value.Value).Date;

                    bool isChecked = true;
                    foreach (var condition in conditions)
                    {
                        if (!condition.IsChecked(date))
                        {
                            isChecked = false;
                            break;
                        }
                    }

                    if (isChecked)
                    {
                        values.Add(value);
                    }
                }
            }
            return(values);
        }
예제 #7
0
        private void comboBoxFields_SelectedIndexChanged(object sender, EventArgs e)
        {
            QVField field = QlikViewConnectorProxy.Instance.GetQVFieldByName(this.comboBoxFields.SelectedValue.ToString());

            this.dataGridView1.DataSource = field.Values;
        }