Hello everyone,
I would like to exportobjects to txt file automatically for source code version control in Nav 2013.
Unfortunately calling exportobjects function in codeunit fails with error that it is not supported.
Other method i see is using command=exportobjects command line argument in finsql.exe.
Unfortunately i am struggling to use this because of the license problem.
I want to use this export on production environment and this means that database has loaded customer license without the permission to export to text. I cant find a way to force finsql to use different license (developer license ) provided in the file.
I tried putting it in services folder under fin.flf name but still it fails.
Do you have any ideas how i can achieve this?
0
Comments
OBJECT Codeunit 50000 expalt
{
OBJECT-PROPERTIES
{
Date=19-04-13;
Time=10:17:28;
Modified=Yes;
Version List=;
}
PROPERTIES
{
OnRun=BEGIN
NavisionPath := 'C:\Program Files (x86)\Microsoft Dynamics NAV\70\RoleTailored Client\';
servername := 'CD-02-TST\NAVDEMO';
databasevar := 'Demo Database NAV (7-0)';
Path := 'c:\navSource\';
AllObj.SETFILTER("Object Type", '<>%1&<>%2', AllObj."Object Type"::TableData, AllObj."Object Type"::System);
IF AllObj.FINDSET THEN BEGIN
fil.TEXTMODE(TRUE);
fil.CREATE('c:\Export.tmp');
fil.WRITE('@echo off');
fil.WRITE('@echo Exporting...');
fil.WRITE('if exist ' + Path + ' (');
fil.WRITE('rd /s /q ' + Path);
fil.WRITE(')');
fil.WRITE('md ' + Path);
fil.WRITE('cd ' + NavisionPath);
REPEAT
filnavn := CONVERTSTR(AllObj."Object Name", '/&,','___');
cmd :=
'finsql.exe command=exportobjects, file=' +
Path + filnavn + '-' + FORMAT(AllObj."Object ID") +
'.' + FORMAT(AllObj."Object Type") +
'.txt, servername=' + servername + ', database="' + databasevar + '", filter="Type=' +
FORMAT(AllObj."Object Type") + ';ID=' + FORMAT(AllObj."Object ID") +
'", logfile=' + Path + 'fejl.txt';
fil.WRITE(cmd);
fil.WRITE('if exist ' + Path + 'fejl.txt (');
fil.WRITE('type ' + Path + 'fejl.txt');
fil.WRITE(')');
UNTIL AllObj.NEXT = 0;
fil.WRITE('@echo Exporting Finished');
fil.WRITE('pause');
fil.CLOSE;
END;
END;
}
CODE
{
VAR
AllObj@1161027000 : Record 2000000038;
Path@1161027001 : Text[250];
cmd@1161027002 : Text[250];
fil@1161027004 : File;
filnavn@1161027003 : Text[250];
servername@1161027005 : Text[250];
databasevar@1161027006 : Text[250];
NavisionPath@1161027007 : Text[250];
BEGIN
END.
}
}