Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Setting a field value or values removes previous selection

I have setup the QlikView OCX to work in my C# winforms app. I have gathered all possible field values for the specific fields that I am looking to target. I have created selectors that hold that data in .NET controls. The user would make selections within the .NET controls and click a button to set the field values.

I can easily set a field value for one of the fields. For example I am having no problem setting the date when that is the only option selected. However, if the user then makes a "company" selection along with the date selection, only the company selection is set. I can see in my current selections object that the date was initially set, very briefly, then when the company gets set it overrides the previous date selection. All I am left with is just the company selection, no date.

Here is the code I have:

private void SetValues()
{
  
Field dateField = qvDoc.GetField("Date");
  dateField
.Clear();
  
IArrayOfFieldValue selectedDateFields = tradeDateField.GetNoValues();
  selectedDateFields
.Add();
  selectedDateFields
[0].Number = Convert.ToDouble(qvDoc.Evalueate("=num('" + (DateTime)ddlDate.EditValue _ "')"));
  selectedDateFields
[0].IsNumeric = true;
  dateField
.SelectValues(selectedDateFields);

  
Field companyField = qvDoc.GetField("Company");
  companyField
.Clear();
  
IArrayOfFieldValue selectedCompanyFields = companyField.GetNoValues();
  
for (int i = 0; i < selectedCompanies.Count; i++)
  
{
  selectedCompanyFields
.Add();
  selectedCompanyFields
[i].Text = selectedCompanies[i];
  
}
  companyField
.SelectValues(selectedCompanyFields);

}

When running that method I would expect to see my current selections set with a date and company. Only the company is being set. What am I missing? Why does this remove my previous selection?

0 Replies