Productive Computing, Inc. Support Forum

Plug-ins => FM Books Connector => Topic started by: Paolobkk on February 22, 2013, 03:27:39 AM

Title: Why many "setVariable" with the same variable?
Post by: Paolobkk on February 22, 2013, 03:27:39 AM
Hello everyone,

Just landed on this Forum looking for a little help on how to use the FM Books connector Plug-in.

I've downloaded all the documentation and demo file, and I've been studying for few days about how to script using the Plug-in functions.

Looking at the scripts of the demo file I've seen many script steps setting always the same variable:

Set Variable[$$Result; Value:PCQB_RqAddFieldWithValue( "CustomerRef::ListID" ; Customer::ListID )]
Set Variable [$$Result; Value:PCQB_RqAddFieldWithValue( "TxnDate"; Invoice::Invoice Date)]
Set Variable [$$Result; Value:PCQB_RqAddFieldWithValue( "PONumber";Invoice::PO Ref)]
Set Variable [$$Result; Value:PCQB_RqAddFieldWithValue( "DueDate"; Invoice::Due Date)]
Set Variable [$$Result; Value:PCQB_RqAddFieldWithValue( "ShipDate"; Invoice::Ship Date)] #Prep Line Items (Request)

I couldn't find any explanation on the use of this variable and I didn't notice any following script step where it's used for something.

Can anyone address me in the right direction? :o

Thanks and have a great day!!
Title: Re: Why many "setVariable" with the same variable?
Post by: Geoffrey Gerhard on February 22, 2013, 07:20:43 AM
The Set Variable step provides a place to call the function. The variable name is irrelevant, and so is the scope--it could be $Whatever. Many people use the $$Result convention so that they can interact with QB in a subscript, and then check the value of $$Result in the calling script to be sure the interaction was successful.

Some argue that a stack of Set Variable steps is easier to read and understand than it would be to stack the calls up in a single Set Variable's calc like this...

Set Variable[$$Result; Value:
PCQB_RqAddFieldWithValue( "CustomerRef::ListID" ; Customer::ListID )
PCQB_RqAddFieldWithValue( "TxnDate"; Invoice::Invoice Date)
PCQB_RqAddFieldWithValue( "PONumber";Invoice::PO Ref)PCQB_RqAddFieldWithValue( "DueDate"; Invoice::Due Date)
Set Variable [$$Result; Value:PCQB_RqAddFieldWithValue( "ShipDate"; Invoice::Ship Date) ]

...which would return the same result. The only result that's really relevant is the one returned by PCQB_RqExecute, which is what triggers the actual interaction with QB.


Geoffrey Gerhard
Creative Solutions Incorporated
14000 Creekside Drive
Matthews, NC  28105
704) 814-6852
Title: Re: Why many "setVariable" with the same variable?
Post by: Paolobkk on February 22, 2013, 06:57:45 PM

Finally got it!

We are installing QB in our company and I have to integrate it with my FM11 database.

The documentation on FM books connector is technical and precise but I didn't find very helpful tutorials on scripting... so I have to dig in much more!  :-\

Thank you so much for your help! :)
Title: Re: Why many "setVariable" with the same variable?
Post by: scstock on March 03, 2013, 07:57:25 AM
I'm so glad someone asked this question! - thanks Geoffrey for the clear response too.