Can anyone tell me how this can be happening? I have a function to retrieve records from a UD table and select the first row if count > 0. Number of rows returned is correct, however, the edv.row is still being set to -1 instead of 0.
Correct. This function is called from InitializeCustomCode().
private void InitializeStructure()
{
// Create an instance of the Adapter.
this.StructureAdapter = new UD11Adapter(this.oTrans);
this.StructureAdapter.BOConnect();
this.edvProject = ((EpiDataView)(this.oTrans.EpiDataViews["UD10"]));
// Add Adapter Table to List of Views
// This allows you to bind controls to the custom UD Table
this.edvStructure = new EpiDataView();
this.edvStructure.dataView = new DataView(this.StructureAdapter.UD11Data.UD11);
this.edvStructure.AddEnabled = true;
this.edvStructure.AddText = "New Structure";
if ((this.oTrans.EpiDataViews.ContainsKey("StructureView") == false))
{
this.oTrans.Add("StructureView", this.edvStructure);
}
// Initialize DataTable variable
this.Structure_Column = this.StructureAdapter.UD11Data.UD11;
// Set the parent view / keys for UD child view
string[] parentKeyFields = new string[1];
string[] childKeyFields = new string[1];
parentKeyFields[0] = "Key1";
childKeyFields[0] = "Key1";
this.edvStructure.SetParentView(this.edvProject, parentKeyFields, childKeyFields);
if ((this.oTrans.PrimaryAdapter != null))
{
// this.oTrans.PrimaryAdapter.GetCurrentDataSet(Ice.Lib.Searches.DataSetMode.RowsDataSet).Tables.Add(this.edvStructure.dataView.Table.Clone())
}
}
One other note: I have the UD11 table set up as a child table of UD10. This case only happens when I use the native search to select an existing UD10 record. If a known value is entered, everything loads correctly. With more than one UD10 record selected, changing rows in the UD10 view works. Changing rows in the UD11 view works. This only occurs initially when UD10 record(s) are selected using the native search.
I’d bet a cheap beer that the issue is caused by the parent\child relationship. Since the UD11 is filtered by its UD10 parent, it’s like the notification hasnt happened yet on the parent to tell the child what it should see. If you wanted a dirty test, just temporarily disable the parent\child.
On how to solve it, perhaps some sort of notify is needed - perhaps you could get away with settings the UD10 row manually and notifying first.