Navigation:


FORUMS > SentryFile Version 5 Topics > SF5 - API Integration / Programming Assistance < refresh >
Topic Title: DocuCore API - Search_IndexAsGrid
Created On Wed February 20, 2013 9:33 PM
Topic View:

View thread in raw text format


mneal

Posts: 4
Joined: Feb 2013

Wed February 20, 2013 9:33 PM
User is offline

I'm having a problem with using the Search_IndexAsGrid function in my ASP.NET MVC web application. I connect to it via the Service References feature in Visual Studio 2010. I want to search by StudentID and return documents matching my search. I've attached a pertinent snippet of code (written in C#).

Some notes:

    docList is of type DataSet - this is what the Service Reference returns.

    cabinetID, sortIndexID, studentIndexID, and searchID all return what appear to be valid values.

    Search_IndexSearchCriteriaAdd does return a "true" boolean value.

    When I use the Search_BrowseAsGrid function, I do receive all documents for that cabinet.

    I get a SoapException on Search_IndexAsGrid, which is listed below.


System.ServiceModel.FaultException was unhandled by user code
HResult=-2146233087
Message=System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.Data.OleDb.OleDbException: Incorrect syntax near 'AND'.
at System.Data.OleDb.OleDbDataReader.ProcessResults(OleDbHResult hr)
at System.Data.OleDb.OleDbDataReader.NextResult()
at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method)
at System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.OleDb.OleDbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet)
at DocuCore.SelectQuery(Int32 user_id, String query)
at DocuCore.Search_Index(String sessionid, Int32 indexsearch_id)
at DocuCore.Search_IndexAsGrid(String sessionid, Int32 indexsearch_id)
--- End of inner exception stack trace ---
Source=mscorlib
StackTrace:
Server stack trace:
at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at SentryFileWSDemo.DocuCore.DocuCoreSoap.Search_IndexAsGrid(String sessionid, Int32 indexsearch_id)
at SentryFileWSDemo.DocuCore.DocuCoreSoapClient.Search_IndexAsGrid(String sessionid, Int32 indexsearch_id) in C:\source\SentryFileWSDemo\SentryFileWSDemo\Service References\DocuCore\Reference.cs:line 3551
at SentryFileWSDemo.PlansSentryFile.GetCabinetFiles(String storageName, String studentID) in C:\source\SentryFileWSDemo\SentryFileWSDemo\PlansSentryFile.cs:line 49
at PlansSentryFile.Models.SentryFileDocument.GetDocuments(String studentID) in C:\source\SentryFileWSDemo\PlansSentryFile\Models\SentryFileDocument.cs:line 32
at PlansSentryFile.Controllers.SentryFileController.Index(Int32 caseID) in C:\source\SentryFileWSDemo\PlansSentryFile\Controllers\SentryFileController.cs:line 37
at lambda_method(Closure , ControllerBase , Object[] )
at System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters)
at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass42.b__41()
at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass8`1.b__7(IAsyncResult _)
at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.End()
at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass37.<>c__DisplayClass39.b__33()
at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass4f.b__49()
InnerException:

                    int cabinetID = docuCore.Repository_RetrieveID(sessionID, storageNames[i].Trim());
                    int sortIndexID = docuCore.RepositoryField_RetrieveID(sessionID, "DocumentType", cabinetID);
                    int studentIndexID = docuCore.RepositoryField_RetrieveID(sessionID, "StudentID", cabinetID);
                    int searchID = docuCore.Search_IndexSearchCreate(sessionID);
                    bool result = docuCore.Search_IndexSearchCriteriaAdd(sessionID, searchID, cabinetID, studentIndexID, "=", studentID);
                    docList.Merge(docuCore.Search_IndexAsGrid(sessionID, searchID));

 
Reply
   
Quote
   
Top
   
Bottom
     



SupportRep

Posts: 6587
Joined: Feb 2004

Wed February 20, 2013 9:38 PM
User is offline

Hmmm... The important part of that error is: Incorrect syntax near 'AND'.

When you run this line:

bool result = docuCore.Search_IndexSearchCriteriaAdd(sessionID, searchID, cabinetID, studentIndexID, "=", studentID);

Does the "studentID" variable have a value?

-------------------------
-SentryFile Support
 
Reply
   
Quote
   
Top
   
Bottom
     



mneal

Posts: 4
Joined: Feb 2013

Wed February 20, 2013 9:57 PM
User is offline

Thanks for the fast response! Yes, studentID is a string containing the value by which I want to search. For purposes of my testing it is set to "2222222". When I perform the same search using the SentryFile GUI it returns one document, as I would expect.

Also, a couple more notes which I forgot to mention earlier:

    For the criteria_operator argument, I tried both "Equals" and "=" with the same result. I'm not sure which is expected here.

    The version of SentryFile being used is v5.13.
 
Reply
   
Quote
   
Top
   
Bottom
     



SupportRep

Posts: 6587
Joined: Feb 2004

Wed February 20, 2013 9:59 PM
User is offline

The operator should match the SentryFile GUI.... So, I believe it is "Equals". Would you mind trying again?

-------------------------
-SentryFile Support
 
Reply
   
Quote
   
Top
   
Bottom
     



mneal

Posts: 4
Joined: Feb 2013

Wed February 20, 2013 10:14 PM
User is offline

Sure. To confirm, I'm pasting my new code snippet below (even though I just made that one change).

Every parameter is filled out as I'd expect, and the return value of Search_IndexSearchCriteriaAdd is true. I still run into the same exception on Search_IndexAsGrid: "System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.Data.OleDb.OleDbException: Incorrect syntax near 'AND'."

I also tried removing the Search_IndexAsGrid call out of my docList.Merge function, to make sure docList.Merge wasn't somehow tripping the error. No luck; it's the same exception.

                    int cabinetID = docuCore.Repository_RetrieveID(sessionID, storageNames[i].Trim());
                    int sortIndexID = docuCore.RepositoryField_RetrieveID(sessionID, "DocumentType", cabinetID);
                    int studentIndexID = docuCore.RepositoryField_RetrieveID(sessionID, "StudentID", cabinetID);
                    int searchID = docuCore.Search_IndexSearchCreate(sessionID);
                    bool result = docuCore.Search_IndexSearchCriteriaAdd(sessionID, searchID, cabinetID, studentIndexID, "Equals", studentID);
                    docList.Merge(docuCore.Search_IndexAsGrid(sessionID, searchID));

 
Reply
   
Quote
   
Top
   
Bottom
     



SupportRep

Posts: 6587
Joined: Feb 2004

Thu February 21, 2013 1:50 AM
User is offline

Okay, there must be one of the parameters that has an invalid entry. The next possible cause would be this line:

int searchID = docuCore.Search_IndexSearchCreate(sessionID);

Could you verify that the "searchID" variable received an integer value?

Also, could you try setting your criteria operator to "EQUALS" (uppercase)? I *think* these operators are case sensitive and must be uppercase.

Please let me know if this helps!

-------------------------
-SentryFile Support
 
Reply
   
Quote
   
Top
   
Bottom
     



mneal

Posts: 4
Joined: Feb 2013

Thu February 21, 2013 3:20 PM
User is offline

I set the search operator to "EQUALS" in all uppercase, as you suggested, and that works! Thanks a lot for your quick responses and your help!

I'd like to suggest finding a way to expand on your documentation, so that people consuming the DocuCore web service have a better idea of what arguments we should be passing in. Some are self explanatory, such as sessionid, but I feel as if others may struggle with this criteria_operator argument. In addition, it might be helpful in cases in which a result set is returned (either via DataSets in .NET or via XML), to include more details on how that result set is constructed. I had to actually step through my code and look in my DataSet to figure this out. Perhaps I'm missing something, though.

Again, thanks a million for your help - this has been one of my better support experiences with any company, software or otherwise.
 
Reply
   
Quote
   
Top
   
Bottom
     



SupportRep

Posts: 6587
Joined: Feb 2004

Thu February 21, 2013 3:24 PM
User is offline

Hi,

Glad you got it fixed!

You're totally right about more documentation on the web services - we agree fully! We're working towards improving the documentation as we move forward. Thank you for your suggestion!

Cheers

-------------------------
-SentryFile Support
 
Reply
   
Quote
   
Top
   
Bottom
     

View thread in raw text format
FORUMS > SentryFile Version 5 Topics > SF5 - API Integration / Programming Assistance < refresh >

Navigation:

FuseTalk 4.0 © 1999-2003 FuseTalk Inc.