Author Topic: Invoice Pull Script: Endless Loop & Missing Portal Rows  (Read 2117 times)

james_finnerty

  • Member
  • *
  • Posts: 1
Invoice Pull Script: Endless Loop & Missing Portal Rows
« on: August 17, 2011, 08:36:20 AM »
Hi,

I've been working on a script to pull invoices and line items from QB and add them to one single Invoice template in FM.

It has been successful up to the point that I noticed the Loop script step is not ending (resulting in 25,000 records on my first pull when there should have only been 2100).

The other problem that I am having is that the script only managed to pull one line item per invoice. I believe this is a problem with the Go To Portal Row step, but am not sure how to fix it.

I've attached the script here. If anyone could offer some suggestions it would be much appreciated.

Thanks!
James

ellenmellody

  • Member
  • *
  • Posts: 1
Re: Invoice Pull Script: Endless Loop & Missing Portal Rows
« Reply #1 on: August 19, 2011, 06:27:47 AM »
Why don't you check out the starting coding, might be there is any mistake.

Chris

  • God
  • Member
  • *****
  • Posts: 83
Re: Invoice Pull Script: Endless Loop & Missing Portal Rows
« Reply #2 on: August 22, 2011, 08:24:22 AM »
hi All,

There are several problems with the script, but we will address only the two cheif complaints.  First, the main loop for creating an invoice in FileMaker will never end because the 'Exit Loop If' statement is testing the $$RESULT variable, but the result of the PCQB_RsGetNextRecord function is being saved in a field.  The loop test and the PCQB_RsGetNextRecord should be the same variable or global field.  Second, only one line item is being created because that is all the script is parsing.  The script will need a second loop to parse the remaining line items.

Chris