Author Topic: FileBooksLink to FMBooks before and after script  (Read 3762 times)

freddyolsen

  • Member
  • *
  • Posts: 2
FileBooksLink to FMBooks before and after script
« on: April 19, 2010, 09:07:33 AM »
Hello all,

I am very new to this product and am attempting to migrate from FBL to FMB.  The FBL scripts were developed by someone else.  I am at best intermediate with FM development.  We upgraded Quickbooks to version 8, and all of the FMB scripts stopped working due to a registration issue.  I have downloaded the demo of FMbooks and plan to use it, but am having difficulty digesting the functions and migration guides without syntax examples.  I have begun to examine the existing scripts in the demo of FBL, but am starting to experience overwhelm.  I think it would be useful to see a before and after snapshot of someone's scripts in a migration.  Does anyone have this available to post?

thanks,

Freddy

Here is an example of an existing script that I am trying to migrate:


Geoffrey Gerhard

  • Guru
  • Member
  • ****
  • Posts: 470
Re: FileBooksLink to FMBooks before and after script
« Reply #1 on: April 24, 2010, 09:25:05 AM »
Freddy:

Your attached script shows that you're using FBLink 4 or earlier, which makes the migration path harder to follow. That version used the "|" character to separate a function's parameters, the type of function call is identified as its own parameter, and the order of the parameters sometimes differs significantly from the corresponding function in FMBooks.

If you have a solid understanding of the FBLink functions and their parameters, the learning curve is less steep. I recommend that you look at page 4 of the Migration Guide-FM Books Connector.

http://www.productivecomputing.com/docs/docs_library/FM_Books_Connector/Migration_Guide_FM_Books_Connector.pdf

Because Productive Computing created a series of "Z" functions that correspond to the function found in FBLink, you won't need to redo the bulk of your code, just replace the External("fbLink-whatever" calls with the equivalent FMBooks function. You'll sometimes need to change the order of your parameters, which is easy as long as you can identify them by looking at the original documentation. Here's a simple example from your attached script....

FBLink:
External("fbLink- FormatData"; Residential::DEVELOPER & "|" & "STRTYPE")

FMBooks:
PCQB_SFormatString ( Residential::DEVELOPER ; "STRTYPE")


Here's line 23 of your script (the line that adds the Invoice to QB and sets the parsed out RefNumber to your field Job Phases::QBsInvNo) showing the parameter order and your implementations of them in each plug-in...

FBLink:
External("fbLink-Execute_qbXML"; optFilePath|Xpath|qbXML )
External("fbLink-Execute_qbXML"; "*|" & "InvoiceAddRs/InvoiceRet/RefNumber/text()" & "|" & Job Phases::QB_XML )

FMBooks:
PCQB_ZExecute( XPath ; qbXML ; optFilePath )
PCQB_ZExecute( "InvoiceAddRs/InvoiceRet/RefNumber/text()" ; Job Phases::QB_XML ; "" )


Note: In FBLink the "*" parameter indicates that the function applies to the currently open QB file. You don't need the asterisk in FMBooks, so I left the last parameter empty. You could, in fact, omit the last semicolon and double quote.

You'll also need to change your error trapping. When a request could not be processed, FBLink returned an explanation preceded by "$$". FMBooks returns "!!ERROR!!" and no explanation. (Use PCQB_SGetStatus to get the details.)


Line 27 uses a too elaborate version of Left ( targetField ; 2 ) = "$$". I've changed that test in all of the conversions I've done to Left ( targetField ; 9 ) = "!!ERROR!!", but simply changing "$$" to "!!" might be acceptable.

Hope this helps you get started. If you get stuck, post here. If you find that it's more than you want to tackle, I'd be happy to help you make the transition.


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

Chris

  • God
  • Member
  • *****
  • Posts: 83
Re: FileBooksLink to FMBooks before and after script
« Reply #2 on: May 14, 2010, 05:30:50 PM »
Kudos Geoff.

freddyolsen

  • Member
  • *
  • Posts: 2
Re: FileBooksLink to FMBooks before and after script
« Reply #3 on: May 20, 2010, 07:49:18 AM »
Geoffrey,

Thank you very much for taking the time, and for showing actual examples.  This was very helpful and I appreciate it greatly.  I bought 2 licenses I have begun the migration and so far so good.

I have one legacy item that is boggling me a bit, it was a validation field of sorts that i have present on a layout that would always show the quickbooks ID as it relates to a customer on the filemaker side.  

it's definition was as follows:

If (1=1; // enable or disable the Quickbooks lookup
Case(not IsEmpty(DEVELOPER);
External("fbLink-Query";
"*|" &
"/CustomerQueryRs/CustomerRet/ListID/text()"  &"|" &
"Customer" & "|" &
"<FullName>"  & External("fbLink-FormatData"; DEVELOPER& "|" & "STRTYPE") & "</FullName>"
)
);0)


I tried changing it to this to get a similar result, but the begin and end session usage has me confused:


If (PCQB_BeginSession( "" ; "Multi" );

Case(not IsEmpty(DEVELOPER);

PCQB_ZQuery( "/CustomerQueryRs/CustomerRet/ListID/text()"; "Customer" ; "<FullName>"  & PCQB_SFormatString( DEVELOPER; "STRTYPE")  & "</FullName>")

)    &   If(PCQB_EndSession ; ""; "");0)

I think I am missing something fundamental about begin and end  here, but i cant quite get to it.  Any more insight would be appreciated.

Thanks,

Freddy

Geoffrey Gerhard

  • Guru
  • Member
  • ****
  • Posts: 470
Re: FileBooksLink to FMBooks before and after script
« Reply #4 on: June 04, 2010, 02:09:36 PM »
Freddy...

When you say "it was a validation field of sorts" what do you mean? Is it a calculation field? If so: what are the field's storage options set to do?

Because a Customer ListID value will not change, I'm not sure what value is added by having a calc repeatedly querying the database.

The forgoing aside, I think your calc will always return 0 because PCQB_BeginSession returns 0 if successful. That means your true result would only be evaluated if the FMBooks Connector fails to open a connection. And that, ironically, would fail for lack of a connection.

Hope this helps--post again if not.

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