Help with SubConShipEntryAdapter

Hello, I am currently using the SubConShipEntry adapter inside a customization for POEntryForm so that I can find if a SubShipD line exist for the current PO loaded. In that case I add a where clause for the Table SubShipD “PONum = {PO from epidataview}”

It actually works but it can take like 10-15 secs before it finish loading and that seems pretty long for the simple query I am doing. Trying different things I noticed that there is 1 row in the SubShipD dataset which is the result I want, but there is also 4337 rows in the SubShipH dataset, which is the total number of row in the SQL table… I guess that’s why it is so slow then.

If I add a where clause on the SubShipH that would make it return 0 row, the SubShipD dataset also return 0. Is there any way to get results only from the SubShipD table? Or have some sort of inner join between the two so it only get the Header row from the Detail line found (Which I thought would be the default behavior)?

Thanks

SubShipAdp = new SubConShipEntryAdapter(oTrans);
SubShipAdp.BOConnect();

SearchOptions opts = new SearchOptions(SearchMode.AutoSearch);
opts.DataSetMode = DataSetMode.RowsDataSet;
opts.NamedSearch.WhereClauses.Add("SubShipD", "PONum = "+this.edvPOHeader.CurrentDataRow["PONum"].ToString());
SubShipAdp.InvokeSearch(opts);

MessageBox.Show(SubShipAdp.SubConShipEntryData.SubShipH.Rows.Count.ToString()+":"+SubShipAdp.SubConShipEntryData.SubShipD.Rows.Count.ToString());

SubShipAdp.Dispose();
SubShipAdp = null;

A Rows Dataset is obviously larger than a List dataset, so thats one thing to consider.

Perhaps a BOReader would help.

However, if you intend to manipulate the data you will have to stick with the adapter. You could save a sliver of time if you didnt have to create\instanciate the adapter in that call - aka it was a global already created (just dont forget to adapter.ClearData() first)

1 Like

I tried changing the datasetmode to ListDataSet and read the results from SubConShipEntryList.Tables, it seems faster but there’s only one table with 4337 results again.

I see informations on creating a BOReader but I have no idea what it is or how to use it?

I won’t change the data I find with it but I will have to use the adapter to create a new SubShipH and SubShipD if no result is returned.

After looking around some more I think In the end I’ll use a BAQ and the dynamicQueryAdapter.

Thanks for the info

You might just have to add before your SubShipD

opts.NamedSearch.WhereClauses.Add("SubShipH", "PONum = "+this.edvPOHeader.CurrentDataRow["PONum"].ToString());

PONum is not an existing column on SubShipH so it causes an error

That’s why I only need to query the subtable

What if you use the Business Object then?

Erp.Contracts Namespace > SubConShipEntrySvcContract Interface : GetRows Method

[OperationContractAttribute("GetRows")]
[FaultContractAttribute(DetailType=Ice.Common.EpicorFaultDetail, 
   Action="", 
   Name="", 
   Namespace="", 
   ProtectionLevel=ProtectionLevel.None, 
   HasProtectionLevel=false)]
SubConShipEntryTableset GetRows( 
   string whereClauseSubShipH,
   string whereClauseSubShipHAttch,
   string whereClauseSubShipD,
   string whereClauseSubShipDAttch,
   string whereClauseShipCOO,
   string whereClauseSubShipUPS,
   string whereClauseLegalNumGenOpts,
   string whereClauseSelectedSerialNumbers,
   string whereClauseSerialNumberSearch,
   string whereClauseSNFormat,
   int pageSize,
   int absolutePage,
   out bool morePages
)

Actually the Adapter even supports GetRows

SubShipAdp.GetRows(SearchOptions opts. out bool morePages, params string[] whereClauses)

It will then call the BO with

subConShipEntryBO.GetRows(whereClauses[0], whereClauses[1], whereClauses[2], whereClauses[3], whereClauses[4], whereClauses[5], whereClauses[6], whereClauses[7], whereClauses[8], opts.PageSize, opts.AbsolutePage, out MorePages);

So you must still defined all the Array Keys, but you dont have to give it any values.

whereClauses[“SubShipH”] = “”;
whereClauses[“SubShipHAttch”] = “”;

etc…

In this order.

whereClauseSubShipH,
whereClauseSubShipHAttch,
whereClauseSubShipD,
whereClauseSubShipDAttch,
whereClauseShipCOO,
whereClauseSubShipUPS,
whereClauseLegalNumGenOpts,
whereClauseSelectedSerialNumbers,
whereClauseSerialNumberSearch,
whereClauseSNFormat

You can probably just use the Wizard in the Customization Dialog to call the GetRows method it will show you the params it needs.