Auto SQL Import Jobs
Previous Topic  Next Topic 

The auto SQL import jobs command enables you to import jobs into DMS via a predefined SQL script.  This command is the same as selecting the Interface | SQL Import | Job Import via SQL manually from the DMS menu.  The SQL script is defined using Interface | Import Settings | Job Import SQL Scripts.


In order to import jobs automatically, the user name provided for the login must have access to both the “Enable Auto User Login” and the “Import jobs using SQL”. 


The parameter for the automatic import jobs is:


       AutoSQLImportJobs=command file        


For example, to login to the database WorkData with a user name of Jan Smith to import jobs via an SQL script using the command file C:\Program Files\Dynafact\Import Jobs Cmd.TXT the following would be used:


       DMSEnt “AutoUserName=Jan Smith” DatabaseName=WorkData “AutoSQLImportJobs=C:\Program Files\Dynafact\Import Jobs Cmd.TXT"        


The “command file” is an existing text file that holds the SQL import jobs command information.  The command file parameters must never be surrounded in quotation marks even if the parameter has a space in it.  The following commands are given in the schedule command file: 


  1. SQLScriptName =(The name of the existing SQL script to run)
  2. ReportStatusFilename=(Filename to write the import status and any errors to.  If not given, the default filename of import folder\ ImportSQLStatus.TXT will be used.
  3. DefaultJobState=(The default job state if not given on the SQL import job script; optional; if not given and a default is required, the default set in the Terms and Settings will be used)
  4. AddResourcesIfRequired= YES/NO (default YES)
  5. ApplyImportTable= YES/NO (Default=YES; indicates whether or not to apply the Import Interface Table)
  6. AddInventoryIfRequired= YES/NO (default NO)
  7. JobSecurityProtectionCheck=YES/NO  (default NO; if no, the status of the job security protection is not checked and all jobs are updated.  If yes, the status of the job security protection is checked and only updated if the protection allows the update.)
  8. SetMaterialReceivedIfAvailable=YES/NO (default YES; if you are importing material you can chose how the Material Available flag is set.  If selected and the material available import is true and the material received date is blank, then the import will set the material date received to current date.  If this option is not selected, the Material Date Received is not updated during the import.)
  9. SetAndActualsToPrime=YES/NO (default YES; if selected, then any AND operation's actual time, quantities and operation status will be set to the prime operation's actual time, quantities and operation status.  In most cases, you want to have this option selected.)
  10. RefreshMaterialRequirements=YES/NO (default NO; if YES is selected, DMS deletes all exiting material requirement items for a given job before adding the job's material requirements.  If not selected, material requirements are not deleted before adding new material.)
  11. BackFlush=YES/NO (default NO; if YES is selected, DMS will backflush operations by seting all operations from the last completed operation back to the beginning of a job to a status of complete.  If NO, a backflush does not occur.)
  12. AddAllocations=YES/NO (default is NO;  If YES is selected, add assembly allocations enables a component job in one assembly to feed into a component job in another assembly or to feed an independent job.  If an assembly component with a given order number exists and the same order number is added to a different assembly, the import will automatically setup an allocation (BOM link) between the first assembly component and the second assembly component.  If NO is selected, the duplicate order number being added to an assembly will be rejected.)


The following example shows a command file that will run the SQL script "DMS SQL Job Import", write the import status to a file called "ReportStatusFilename=C:\Program Files\Dynafact\DMS\Export\SomeResults.Txt", add resources if they do not exist, and do not apply the Import Interface Table.  Because the parameter DefaultJobstate is not given, the default job state set in the Terms and Settings will be used as required.  Also, since the parameter JobSecurityProtectionCheck is not given, it defaults to No:


SQLScriptName=DMS SQL Job Import

ReportStatusFilename=C:\Program Files\Dynafact\DMS\Export\SomeResults.Txt

AddResourcesIfRequired= Yes

ApplyImportTable=No


Note that if you want to run an import command more than once, you must specify an entirely new command line.  For example, if you want to run three SQL import commands, the following command lines would be used:


"C:\Dynafact\Production\DMS\DMSEnt.exe" "UserIniFolder=C:\Dynafact\Production\DMS\User\" "AutoUserName=DMS" " DataBaseName=DMSCopy" "AutoSQLImportJobs=C:\Program Files\Dynafact\DMS\ImportCmd1.TXT" "AutoLogOut"

"C:\Dynafact\Production\DMS\DMSEnt.exe" "UserIniFolder=C:\Dynafact\Production\DMS\User\" "AutoUserName=DMS" " DataBaseName=DMSCopy" "AutoSQLImportJobs=C:\Program Files\Dynafact\DMS\ImportCmd2.TXT" "AutoLogOut"

"C:\Dynafact\Production\DMS\DMSEnt.exe" "UserIniFolder=C:\Dynafact\Production\DMS\User\" "AutoUserName=DMS" " DataBaseName=DMSCopy" "AutoSQLImportJobs=C:\Program Files\Dynafact\DMS\ImportCmd3.TXT" "AutoLogOut"


Also see: Automatic Execution Commands