How to find by absolute row number

G

Guest

Here is the situation

I am trying to set up a generic search routine for all datasources in my application. I pass this routine the currency Manager from any application

From the currency manager I figure out the data source and allow the user to select a record by applying a filter or sort that allows them to scan through all the records or create a specialized subset to scan through. When the row has finally been selected I need to set the original source CurrencyManager position to the row that was found in the sub-search

The CurrencyManager List source is usually a DataView. I can only use the Find Method of a DataView if the original DataView was sorted and it my case it may not be sorted in all cases. If there is no sort on the dataview of the original dataSource how can I position it to the row I want without reading through the entire table

Now in my mind what is consistent between the two is the absolute row number in the datasource but I cannot figure out how to access this

Eg
CurrencyManager for CustomerHistory,Unsorted = 10000 rows..



CurrencyManager is passed to a generic routin
which allows the operator to sub-set the histor
say by region, product type, date..(sub-set of 20 rows


One of the 20 rows is selecte
How to set the original currencyManager to the selected ro
when the original DataView is unsorted??? IE say the ro
selected is absoloute row 2000, is there a way of settin
the original currency manager to an absoloute row number
 
B

Bernie Yaeger

Hi Mike,

There is no absolute row index.

Perhaps you can sort the dataview based upon what table the user selected,
some of the selection columns, etc, and then .find in the dataview based
upon that criteria.

HTH,

Bernie Yaeger

Mike in Paradise said:
Here is the situation:

I am trying to set up a generic search routine for all datasources in my
application. I pass this routine the currency Manager from any
application.
From the currency manager I figure out the data source and allow the user
to select a record by applying a filter or sort that allows them to scan
through all the records or create a specialized subset to scan through.
When the row has finally been selected I need to set the original source
CurrencyManager position to the row that was found in the sub-search.
The CurrencyManager List source is usually a DataView. I can only use the
Find Method of a DataView if the original DataView was sorted and it my case
it may not be sorted in all cases. If there is no sort on the dataview of
the original dataSource how can I position it to the row I want without
reading through the entire table.
Now in my mind what is consistent between the two is the absolute row
number in the datasource but I cannot figure out how to access this.
 
G

Guest

Actually the value is there but is hidden under
DataView.index.Record
which is too bad as that would work for me.

What I have done that seems to be working is to temporarily creating a sort on the orginal view, finding the record and then restoring the original sort back to the the dataview.

//Now get the Original Data Source Vie
DataView dataSourceView = (DataView)theCurrencyManager.List

//Save the original sor
String saveDataSourceViewSort = dataSourceView.Sort

//Create a Sorted View for the original Source to use to get ro
dataSourceView.Sort = dataSourceSort

int dataSourceRowNumber = dataSourceView.Find(keys); //Requires Sortin
if ( dataSourceRowNumber >= 0

this.gotoRow.Value = dataSourceRowNumber+1


dataSourceView.Sort = saveDataSourceViewSort;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top