GetRows Epicor BOAdapter

Hey everyone!

I am trying to pull in data from table UD01 in c# that matches a certain criteria; Key1 =020817, and Key3 = 10. I can use BLTester on the server, and the adapter looks like this:

GetRows(String whereClauseUD01, String whereClauseUD01Attch, int32 pageSize, int32 absolutePage, out Boolean morePages)

I enter the following data into BLTester
WhereClauseUD01: (“Key1” = 020817 and “Key3” = 10)
WhereClauseUD01Attch:
pageSize: 0
absolutePage: 1
morePages: false

when using the adapter in c#, it looks like this:

/Ice.Lib.Searches.SearchOptions opts;
/System.Boolean& morePages;

/System.Data.DataSet dsUD01 = adapterUD01.GetRows(opts, out morePages);

I modified it to look like this:

/Ice.Lib.Searches.SearchOptions opts = new Ice.Lib.Searches.SearchOptions(SearchMode.AutoSearch);

/string whereClause = “(Key1 = 020817 and Key3 = 10)”;
/opts.NamedSearch.WhereClauses.Add(“UD01”,whereClause);
/bool morePages = false;

/adapterUD01.GetRows(opts,out morePages);

Is the above code correct? is that the best way to do this? I then try to look up the value Number01 using this code:

/EpiDataView edvPA2 = new EpiDataView();
/edvPA2.dataView = new DataView(adapterUD01.UD01Data.UD01);

/string cyct = Convert.ToString(edvPA2.dataView[edvPA2.Row][“Number01”]);
/MessageBox.Show(cyct);

I keep getting the following error:

Index -1 is either negative or above rows count.

What am I doing wrong? There is 1 record that matches this criteria. Thanks for the help!

i usually use getbyid when i can, so it’s been a while, but your issue may not be your getrows approach but how you are trying to access the data. When calling the method you probably need to bring it back into a container for use. This is not going to be the right syntax but i think it should be something along these lines.

Ice.Lib.Searches.SearchOptions opts = new Ice.Lib.Searches.SearchOptions(SearchMode.AutoSearch);
opts.DataSetMode = DataSetMode.RowsDataSet;
UD01DataSet  UD01ds = (UD01DataSet)adapterUD01.GetRows(opts, out morePages);

accessing it after that would be something like UD01ds.UD01.Rows[0][“number01”]

hopefully that’s it…

3 Likes

you are the man! that was it. works like a charm, thank you so much!

1 Like