2 Replies Latest reply on Feb 13, 2009 11:05 PM by 656517

    Newbie demystifying Import script

      I am new to FDM (and VBscript) and need some clarification on an previously written script in order to fully comprehend what happens when it is executed. Could somebody explain what this part of the FDM Import script does.

      strSQL = "Select * FROM tmAccount where tmAccount.Account=" & "'"& AccountSp & "'"
      Set rsAllocate = DW.DataAccess.farssnap(CStr(strSQL))
      Set RES.PcolRecs = DW.DBTools.fCreateRecCol
      RES.PcolRecs.PblnAdd = True
      RES.PcolRecs.PblnUpdate = False

      I think it is some kind of API statement but have not been able to pinpoint its objective.The info in the Admin and API guides are quite limited.

      I appreciate any info you guys have on this matter.

        • 1. Re: Newbie demystifying Import script

          There isn't much I can say. A majority of the script is missing.

          It is connecting to some database(defined in your script) and pulling back all the records from tmAccount where it equals the variable AccountSp(defined in your script).

          Thank you.
          • 2. Re: Newbie demystifying Import script
            As the previous poster stated, its hard to tell exactly what is happening since we only have a portion of the script; however, I will decrypt the commands a bit more for you :

            DW.DataAccess.farssnap --> Opens an ADO static type readonly recordset
            ** In your code the recordset would be assigned to rsAllocate which is going to have results from the SQL Query Select * from tmAccount where tmAccount.Account = <AccountSp> **
            As we have no idea what is in <AccountSp>, I can't say what its grabbing for sure. Also, tmAccount is not a standard FDM account as far as I can tell. I would have to guess its part of a custom solution?

            DW.DBTools.fCreateRecCol --> Return a reference to a FDM custom record collection used for complex import formats. This reference is an object of records.
            PcolRecs.PblnAdd = True --> This is a property of the fCreateRecCol object (see above). Having this set to true indicates that you will be creating a new record.
            PcolRecs.PBlnUpdate = False --> This is a property of the fCreateRecCol object. Having this set to false indicates that you are not updating a record.

            My guess/hunch is that somewhere farther down in your script you are taking whatever you read from the select statement and inserting it into the custom record collection since its been configured to add a new record.

            Hope that helps