Using SanScript for Retrieving System Database Name in Microsoft Dynamics GP

To get the System DB name when integrating with Dynamics, use the following sanscript code:

---------------------------------------------------------------------------------------------
local integer companyid;
local integer dictionary;
local integer file_series;
local integer logical_file;

companyid = DYNAMICS; {constant with value 0 }
dictionary = DYNAMICS;
file_series = TABLESSERIES_SYSTEM; { constant with value 7 }
logical_file = 0;

set sDatabase to SQL_GetDbName(companyid, dictionary, file_series, logical_file, fSuccess).
---------------------------------------------------------------------------------------------

This routine will then return the string name of the System database. This is all done by accessing the SY_Pathnames table and retrieving the column Database Name.

While it probably is much more proper to do this, it probably isn't worth the effort to get the system series DB from code because installation hardcodes the DB to "DYNAMICS" in all current cases. But it is possible in the future this could change so this isn't a bad idea.

No comments:

Post a Comment