Productive Computing, Inc. Support Forum

Plug-ins => FM Books Connector => Topic started by: tcpms on June 14, 2015, 09:23:47 PM

Title: customer query/return ship address
Post by: tcpms on June 14, 2015, 09:23:47 PM
I want to retrieve the shipping address (among other fields) for a customer in QB. I'm using the 'Response' tab for the field specs for the 'Customer Query' message. The commands I use are:

    PCQB_RqNew("CustomerQuery" ; ""  )
    PCQB_RqAddFieldWithValue( "IncludeRetElement" ; "ShipAddress::Addr1" )
    PCQB_RqAddFieldWithValue( "IncludeRetElement" ; "Phone" )

Every 'PCQB_RqAddFieldWithValue like the 'phone' with a single level of specification works.

None of the 'PCQB_RqAddFieldWithValue' with the 2 levels of specification like 'ShipAddress::Addr1' works. They all return nothing but do not indicate there was an error anywhere in the script (result 0 for all script steps).

Is there a formatting error in the QB field specification for, e.g., ShipAddress::Addr1?

Is this how to retrieve the shipping/billing addresses in QB for a customer, or is there some other way?

Title: Re: customer query/return ship address
Post by: Geoffrey Gerhard on June 15, 2015, 11:18:13 AM
It's been a long time since I looked into this, but I'm pretty sure IncludeRetElement returns only first-level elements. In the case that you've specified a node (like ParentRef, BillAddress, or ShipAddress) you'll get all the elements of that node. I don't think it's possible to filter for only some of the node's child elements using IncludeRetElement.

I think PCQB_RqAddFieldWithValue( "IncludeRetElement" ; "ShipAddress" ) will get the data you identified, albeit with more elements than you specified in your question.


Geoffrey Gerhard
Creative Solutions Incorporated
14000 Creekside Drive
Matthews, NC  28105
704) 814-6852
Title: Re: customer query/return ship address
Post by: tcpms on June 15, 2015, 08:29:21 PM
That's it!

Just using the first level element in the 'includeretelement' provides access to the whole set of sub-elements. E.g., PCQB_RqAddFieldWithValue( "IncludeRetElement" ; "ShipAddress" ) gives access to all the sub-elements of 'ShipAddress' in a Customer Query.

Using the sub-elements in the 'PCQB_RsGetFirstFieldValue' achieves the necessary parsing. E.g., PCQB_RsGetFirstFieldValue("ShipAddress::Addr1") returns just the Addr1 sub-element of the shipping address. Only the sub-elements of interest need be retrieved.

Just what I need!

Thanks for your insight, Geoffrey!