How to set in code the EpidataView record being CurrentDataRow

Hello,

I have say 17 releases in my sales order. How can I programmatically set the edvOrderRel.CurrentDataRow to be the row I need?

I am passing through all the rows to find my matching row (here line=6 and release = 1)
foreach(DataRow rel in edvOrderRel.dataView.Table.Select(string.Format(“OrderNum = {0} and OrderLine = {1} and OrderRelNum = {2}”,order, Line, Release ) ))
{

// here I want to set it as current…
break;

	    }

Would have been nice if CurrentDataRow had a Set… :wink:

thanks Pierre

You should be able reference the row you want to modify and then perform your action on that row, without using the “currentdatarow”. Unless I’m not understanding the requirement?

I am launching OrderEntry from another custom form, passing order, line and release numbers…

so the ideal for me is to set the current datarow of the release epidataview to be the release corresponding to the line/release numbers I have provided…as if I selected manually…

and so far I was not successful…

Say the rowindex is 8 in the dataview… I want to set the edvOrderRel.Row = 8
Pierre

Just set the Row property of the data view

myDataView.Row=10;

3 Likes

Yes I Got that…but my foreach found the valid rel row, how do I extract it’s index value within the edvOrderRel list of records? I could not find such info…

Pierre

Look at the Count property of the dataView.

Ok. The count gives a value of 10 records.

I was able to locate the index. So in my test, the index was 5.
So I set edvOrderRel.Row = 5.
and set the focus of the Release pane in order to view release info of line 6, release 1 or the order.

Well, the release panel view stays at line1, rel 1. So My assumption of setting the row = view of the row is not valid… or am I missing something?

So my general requirement is as soon as the form loads, will open the release pane and show the valid release, of the line and order provided on the form call…

any ideas?

Pierre

Got it !!!

I had to set the Row of the detail line first, then the release. So the index of my release switched from being 5 to 0 because it was the first release of that line…

here is my code for prosperity…:wink:

		int indexDtl = 0; 
		for (indexDtl = 0; indexDtl < edvOrderDtl.dataView.Table.Rows.Count - 1; indexDtl++ )
		{
				if ( ((int)edvOrderDtl.dataView.Table.Rows[indexDtl]["OrderLine"] == LineInput ) )
				{
					break;
				}
		}
	        int indexRel = 0; 
		for (indexRel = 0;indexRel < edvOrderRel.dataView.Table.Rows.Count - 1; indexRel++ )
		{
				if ( ((int)edvOrderRel.dataView.Table.Rows[indexRel]["OrderLine"] == LineInput) && ((int)edvOrderRel.dataView.Table.Rows[indexRel]["OrderRelNum"] ==  RelInput))
				{
					break;
				}
		}	
		edvOrderDtl.Row = indexDtl;
		edvOrderRel.Row = indexRel;
		ReleasePanel.Focus();  
                  //this opens up the release pane with valid line and release number.

Pierre

2 Likes