Productive Computing, Inc. Support Forum

Plug-ins => FM Books Connector => Topic started by: electricz on October 11, 2012, 03:11:06 PM

Title: QB ItemQuery Not functioning?
Post by: electricz on October 11, 2012, 03:11:06 PM
Hi,
   I'm new to FM Books. I'm working on my first implementation, but I'm not getting the results I expect. I'm creating a request for an ItemQuery.
Set Variable[$result; Value:PCQB_RqNew("ItemQuery";"")]

    Even if I don't conduct the request with no filters, the only results I receive are non-inventory parts. No other item types are returned. My reading of the OSR says that this should return all item types.

   I'm using FMBooks 4, Filemaker 11, and QB Premiere 2012.

Thanks for your help!
Title: Re: QB ItemQuery Not functioning?
Post by: electricz on October 11, 2012, 03:46:55 PM
I just checked the xml. It turns out that I'm getting the proper response from QB. However, the plugin is not parsing the full list of values. It's returning "END" when the xml switches to a different item type. I still don't know how to solve the problem.
Title: Re: QB ItemQuery Not functioning?
Post by: Geoffrey Gerhard on October 12, 2012, 07:23:30 AM
I suspect, but don't know for sure, that the plug-in uses XPATH internally to extract the results you expect when invoking the PCQB_Rs... functions. Item (and Terms) are somewhat unique entities, in that they are really a category comprised of multiple elements. You can create a Query Request for either of these elements, and the Response may contain more than one type of Ret element--you saw the xml. Unfortunately, this means that the XPATH is not the same across all returned Item nodes, and I suspect that the plug-in's logic identifies the first Ret node (ItemNonInventoryRet in your case) and each request to OpenNextRecord tests to see whether there is another matching Ret node. Once you've processed all ItemNonInventoryRet nodes, the plug-in returns End, which is logical even if it's not the behavior one might prefer.

So, how can you get all the Items returned?

There are several methods, but the simplest if you don't already know how to format XPATH filters is to break your Item QueryRequest into multiple QueryRequests. Look at Intuit's OSR to see all the Item types, and create a Query for each that's relevant to your project. The good news is that the Response from a QueryRequest for most Item types has a set of identical elements, making it easy to write a single process that extracts the data you need.

HTH!


Geoffrey Gerhard
Creative Solutions Incorporated
14000 Creekside Drive
Matthews, NC 28105
704) 814-6852
Title: Re: QB ItemQuery Not functioning?
Post by: electricz on October 12, 2012, 09:47:12 AM
Thanks Geoffrey,
    I looked into some of the sample files, and noticed that the method you mentioned is how PC approached the problem. I was hoping there was a more elegant solution, but it doesn't appear that there is.