Performing a Query for a specific Error in the Trading Network

Hello

I have written a simple service that attempts to retrieve a message from the “user status” column of the Trading Network database using createDocumentQuery & documentQuery. Unfortunately, the service is pulling every single message without considering the fact that I have associated or mapped a string variable to the “in-service” pipeline string variable “userStatus”. The mapped variable contains the value of the error message. It really couldn’t be much simpler! Anyone have an example preferably or suggestions as to why this query doesn’t work properly? I did try converting the mapped variable containing the error value to UTF-8 format; the query behaved differently and returned all the rows, instead of returning 0 rows when performing no conversion.

I assume that NO documentID is required; the field being used for the selection is “userStatus”

What other inputs you are mapping to wm.tn.query:createDocumentQuery documentQuery services to retrieve the documents?

When you query TN using the TN Console tool, do you get the same number of rows returned as the query you are running in flow?

RMG: the ONLY criteria I am using for selection is the userStatus column. Of course I map the query object to the documentQuery service. I am curious, this is a very simple service, would you be able to simply perform a query by looking for a specific message in the UserStatus column? If it works then I may benefit from reviewing the way you did it; otherwise, it’s a good example of the problem. Either way I very much appreciate your time.

Daniel: I believe the number is very close

I don’t quietly understand your requirement, but try passing the following parameters in the createDocumentQuery senderid,receiverid and messageTypeID (get this from wm.tn.doctype:view and pass TypeName (TNdocumentName)this gives output Type/typeID then map to it)and UserStatus.
And in the documentQuery service set also disablePaging to “true”

HTH,

RMG: Sorry I am not being clear. Here is what I want to do. I want to query the Trading Network for messages that have the words “OUT-OF-SYNCH” in the UserStatus column. It’s that simple

I will then incorporate some date logic , but as yet I am just trying to get this simple query to work correctly.

I looked at the view service and it is used for quering a single document. I do not know what the senderid, receiverid or msgType will be because I am querying for many messages.

I hope this is clear? Again, thank you.

I would have expected based on the criteria you specified that you would have an exact match on the number of documents returned through either function.

What count is returning when you just set “OUT-OF-SYNCH” in the UserStatus column?I believe it should work as expected since this same query works in the TN Analysis section as you said.

RMG:
Sorry for the delay, i did manage to get the query to work properly for retrieving all User Status messages with “OUT-OF-SYNCH” value. THat is working GREAT! THank you :wink:

However, now I am attempting to query on the “Receiver” a column in the TN and it is producing zero results. Actually the variable in “createDocumentQuery” for specifying the Receiving Partner(I assume) is called “recieverld”. When I set the value of the “receiverld” variable to the Partner such as “abc corp”; it returns zero rows, even though I can see the “abc corp” in the TN console under the receiver column. I wonder if I should be using an ID instead of the receiver company name? If so where would one get this ID from??? Or perhaps I am doing something “dumb” again??? Thank you for your patience you have been most helpful.

Evil,
Glad to know it worked.

you can get that Id from using this WmTNWeb service (wm.tnweb.querySvc:getPartnerNameAndID)
this will list all the partner names and id’s.So grab the ID and map to createDocumentQuery (receiverId).

HTH,

RMG:
THAT IS JUST TOO COOL! Thank you very much :wink:

RMG:
I noticed that the attribs collection in “createDocumentQuery” requires a an ID as well for “attribId”. Again, what service do I use to retrieve the attribID?? Where is the documentation from which you are obtaining this information

Thank you