Author Topic: OSR reference - Parent and Child records  (Read 1658 times)

david1000

  • Member
  • *
  • Posts: 21
OSR reference - Parent and Child records
« on: June 06, 2012, 12:28:17 AM »
I am fairly new to QuickBooks XML integration and the following may be a stupid question - so please forgive me if it is.
My question is whether there an easy way to identify a parent and child record in the OSR response list.
At first I was assuming it was the indentation but now I am not sure that this is case.
If anyone can provide the answer, it would be much appreciated.


Geoffrey Gerhard

  • Guru
  • Member
  • ****
  • Posts: 468
Re: OSR reference - Parent and Child records
« Reply #1 on: June 06, 2012, 04:45:18 AM »
Indention provides hints, but isn't infallible.

Across both Transaction and List Requests, you're pulling from a related table anytime the path to an element includes "Ref". Paths that include Address are NOT a child record, even though the user interface in some versions of QB allow Customers to have multiple ShipAddress records.

On Transaction Requests, paths that include the Request type (Add, Mod) are pointing at related tables. Think Bill, Invoice, and ReceivePayment LineItems and their association to both their parent transaction and an Items table. They're children of the transaction, and the Transaction Response replaces the transaction type with "Ret" for those elements.

Almost anywhere you see FullName followed by ListID or TxnID, you're looking at a related table, but not a true child of the current record.

HTH!

Geoffrey Gerhard
Creative Solutions Incorporated
14000 Creekside Drive
Matthews, NC  28105
704) 814-6852

david1000

  • Member
  • *
  • Posts: 21
Re: OSR reference - Parent and Child records
« Reply #2 on: June 06, 2012, 05:20:05 PM »
Thanks Geoffrey, that seems to make a lot of sense.
I will apply what you have outlined to my development and let you know how I go.
I guess it was too much to expect that everything would be compiled into neat and simple relationships;-)
Anyway, thanks again for your response, it is much appreciated.

david1000

  • Member
  • *
  • Posts: 21
Re: OSR reference - Parent and Child records
« Reply #3 on: June 14, 2012, 06:20:39 PM »
Just another note on this:

I've found the PCQB_SGetXML( "Response" ) and PCQB_SGetXML( "Request" ) really helped me understand the FM Books process. Viewing the responding xml code shows how the QB info is stacked together and provides a bit of a clearer picture of the related record metaphor being used by FM Books. For example, I found running a query that returns sample data with a relevant range of entries clearly shows the structure from a QB perspective.

Geoffrey Gerhard

  • Guru
  • Member
  • ****
  • Posts: 468
Re: OSR reference - Parent and Child records
« Reply #4 on: June 15, 2012, 06:24:56 AM »
Agreed. I don't know if you've read through the forum, but I often recommend those as a diagnostic tool. I've been integrating with QB since late 2002 and do all my coding using the PCQB_Z functions and setting/appending their results to a $variable. I build all my Requests as xml in a $variable, and then Execute the result. Seeing the code is too useful to give up.

Seeing the xml is a great visual aid as you start working with XPATH to extract data from complex Responses.

Geoffrey Gerhard
Creative Solutions Incorporated
14000 Creekside Drive
Matthews, NC  28105
704) 814-6852