[Nachtrag]: Das Cmdlet Compile-NavApplicationObject -GenerateSymbolReference -Recompile ist nun auch verfĂĽgbar, um diese bequemer zu erzeugen, Filter auf einzelne Objekte z.B. so setzen -Filter 'Type=Table;ID=50093'
Running C/SIDE and AL Side-by-Side
Mit diesem Skript mit Eingabefenster ist es deutlich einfacher, die Kommandozeile wird damit erzeugt und ausgefĂĽhrt. Der Objektfilter ist dabei optional. Vorher nicht vergessen, das neue Feld Enable loading application symbol references at server startup
auf dem Server zu aktivieren und den Dienst danach neu zu starten.
Im Programmverzeichnis liegt nach Beendigung diese Datei, die aber leider kein Indiz fĂĽr eine korrekte Erzeugung ist, siehe hier .
Der Beispielcode hier für das Fenster enthält übrigens einen Fehler (Script bzw. Global Scope der $x-Variablen fehlen), das ist im Skript natürlich korrigiert .
[Edit 11.02.18] FĂĽr noch mehr Komfort mit einer automatisch generierten Datenbankliste siehe diese Variante hier.
Für Business Central-Programmpfad (hier für Version 13 = Programmpfad …\130\…, für Folgeversionen entsprechend ändern)
- Code: Alles auswählen
function GenerateSymbolsBC
{
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing")
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
function GenerateSymbolsForDatabase
{
[CmdletBinding()]param (
[String]$Server,
[String]$Database,
[String]$ObjectFilter)
$NAVFolder = 'C:\Program Files (x86)\Microsoft Dynamics 365 Business Central\130\RoleTailored Client'
if ($ObjectFilter -ne '')
{$Command = """$NAVFolder\finsql.exe"" command=generatesymbolreference,servername=$Server,database=$Database,filter=$ObjectFilter"}
else
{$Command = """$NAVFolder\finsql.exe"" command=generatesymbolreference,servername=$Server,database=$Database"}
Write-host $Command
cmd /c $Command
}
$objForm = New-Object System.Windows.Forms.Form
$objForm.Text = "Generate Symbols"
$objForm.Size = New-Object System.Drawing.Size(300,300)
$objForm.StartPosition = "CenterScreen"
$objForm.KeyPreview = $True
$objForm.Add_KeyDown({if ($_.KeyCode -eq "Enter") {$script:x=$objTextBox.Text;$script:x2=$objTextBox2.Text;$script:x3=$objTextBox3.Text;$objForm.Close()}})
$objForm.Add_KeyDown({if ($_.KeyCode -eq "Escape")
{$objForm.Close()}})
$OKButton = New-Object System.Windows.Forms.Button
$OKButton.Location = New-Object System.Drawing.Size(75,220)
$OKButton.Size = New-Object System.Drawing.Size(75,23)
$OKButton.Text = "OK"
$OKButton.Add_Click({$script:x=$objTextBox.Text;$script:x2=$objTextBox2.Text;$script:x3=$objTextBox3.Text;$objForm.Close()})
$objForm.Controls.Add($OKButton)
$CancelButton = New-Object System.Windows.Forms.Button
$CancelButton.Location = New-Object System.Drawing.Size(150,220)
$CancelButton.Size = New-Object System.Drawing.Size(75,23)
$CancelButton.Text = "Cancel"
$CancelButton.Add_Click({$objForm.Close()})
$objForm.Controls.Add($CancelButton)
#############
$objLabel = New-Object System.Windows.Forms.Label
$objLabel.Location = New-Object System.Drawing.Size(10,20)
$objLabel.Size = New-Object System.Drawing.Size(280,20)
$objLabel.Text = "Server"
$objForm.Controls.Add($objLabel)
$objTextBox = New-Object System.Windows.Forms.TextBox
$objTextBox.Location = New-Object System.Drawing.Size(10,40)
$objTextBox.Size = New-Object System.Drawing.Size(260,20)
$objForm.Controls.Add($objTextBox)
$objLabel2 = New-Object System.Windows.Forms.Label
$objLabel2.Location = New-Object System.Drawing.Size(10,65)
$objLabel2.Size = New-Object System.Drawing.Size(280,20)
$objLabel2.Text = "Database"
$objForm.Controls.Add($objLabel2)
$objTextBox2 = New-Object System.Windows.Forms.TextBox
$objTextBox2.Location = New-Object System.Drawing.Size(10,85)
$objTextBox2.Size = New-Object System.Drawing.Size(260,20)
$objForm.Controls.Add($objTextBox2)
$objLabel3 = New-Object System.Windows.Forms.Label
$objLabel3.Location = New-Object System.Drawing.Size(10,105)
$objLabel3.Size = New-Object System.Drawing.Size(280,20)
$objLabel3.Text = "Object Filter"
$objForm.Controls.Add($objLabel3)
$objTextBox3 = New-Object System.Windows.Forms.TextBox
$objTextBox3.Location = New-Object System.Drawing.Size(10,125)
$objTextBox3.Size = New-Object System.Drawing.Size(260,20)
$objForm.Controls.Add($objTextBox3)
$objForm.Topmost = $True
$objForm.Add_Shown({$objForm.Activate()})
[void] $objForm.ShowDialog()
#Write-host "$x $x2 $x3"
if (($x -ne '') -and ($x2 -ne '') -and ($x3 -eq ''))
{GenerateSymbolsForDatabase -Server $x -Database $x2}
elseif (($x -ne '') -and ($x2 -ne '') -and ($x3 -ne ''))
{GenerateSymbolsForDatabase -Server $x -Database $x2 -ObjectFilter $x3}
else
{
[System.Windows.Forms.MessageBox]::Show("Please enter server and database. Object Filter is an option.")
Write-Error 'Please enter server and database. Object Filter is an option.'
}
}
GenerateSymbolsBC
FĂĽr NAV-Programmpfad
- Code: Alles auswählen
function GenerateSymbolsNAV
{
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing")
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
function GenerateSymbolsForDatabase
{
[CmdletBinding()]param (
[String]$Server,
[String]$Database,
[String]$ObjectFilter)
$NAVFolder = 'C:\Program Files (x86)\Microsoft Dynamics NAV\110\RoleTailored Client'
if ($ObjectFilter -ne '')
{$Command = """$NAVFolder\finsql.exe"" command=generatesymbolreference,servername=$Server,database=$Database,filter=$ObjectFilter"}
else
{$Command = """$NAVFolder\finsql.exe"" command=generatesymbolreference,servername=$Server,database=$Database"}
Write-host $Command
cmd /c $Command
}
$objForm = New-Object System.Windows.Forms.Form
$objForm.Text = "Generate Symbols"
$objForm.Size = New-Object System.Drawing.Size(300,300)
$objForm.StartPosition = "CenterScreen"
$objForm.KeyPreview = $True
$objForm.Add_KeyDown({if ($_.KeyCode -eq "Enter") {$script:x=$objTextBox.Text;$script:x2=$objTextBox2.Text;$script:x3=$objTextBox3.Text;$objForm.Close()}})
$objForm.Add_KeyDown({if ($_.KeyCode -eq "Escape")
{$objForm.Close()}})
$OKButton = New-Object System.Windows.Forms.Button
$OKButton.Location = New-Object System.Drawing.Size(75,220)
$OKButton.Size = New-Object System.Drawing.Size(75,23)
$OKButton.Text = "OK"
$OKButton.Add_Click({$script:x=$objTextBox.Text;$script:x2=$objTextBox2.Text;$script:x3=$objTextBox3.Text;$objForm.Close()})
$objForm.Controls.Add($OKButton)
$CancelButton = New-Object System.Windows.Forms.Button
$CancelButton.Location = New-Object System.Drawing.Size(150,220)
$CancelButton.Size = New-Object System.Drawing.Size(75,23)
$CancelButton.Text = "Cancel"
$CancelButton.Add_Click({$objForm.Close()})
$objForm.Controls.Add($CancelButton)
#############
$objLabel = New-Object System.Windows.Forms.Label
$objLabel.Location = New-Object System.Drawing.Size(10,20)
$objLabel.Size = New-Object System.Drawing.Size(280,20)
$objLabel.Text = "Server"
$objForm.Controls.Add($objLabel)
$objTextBox = New-Object System.Windows.Forms.TextBox
$objTextBox.Location = New-Object System.Drawing.Size(10,40)
$objTextBox.Size = New-Object System.Drawing.Size(260,20)
$objForm.Controls.Add($objTextBox)
$objLabel2 = New-Object System.Windows.Forms.Label
$objLabel2.Location = New-Object System.Drawing.Size(10,65)
$objLabel2.Size = New-Object System.Drawing.Size(280,20)
$objLabel2.Text = "Database"
$objForm.Controls.Add($objLabel2)
$objTextBox2 = New-Object System.Windows.Forms.TextBox
$objTextBox2.Location = New-Object System.Drawing.Size(10,85)
$objTextBox2.Size = New-Object System.Drawing.Size(260,20)
$objForm.Controls.Add($objTextBox2)
$objLabel3 = New-Object System.Windows.Forms.Label
$objLabel3.Location = New-Object System.Drawing.Size(10,105)
$objLabel3.Size = New-Object System.Drawing.Size(280,20)
$objLabel3.Text = "Object Filter"
$objForm.Controls.Add($objLabel3)
$objTextBox3 = New-Object System.Windows.Forms.TextBox
$objTextBox3.Location = New-Object System.Drawing.Size(10,125)
$objTextBox3.Size = New-Object System.Drawing.Size(260,20)
$objForm.Controls.Add($objTextBox3)
$objForm.Topmost = $True
$objForm.Add_Shown({$objForm.Activate()})
[void] $objForm.ShowDialog()
#Write-host "$x $x2 $x3"
if (($x -ne '') -and ($x2 -ne '') -and ($x3 -eq ''))
{GenerateSymbolsForDatabase -Server $x -Database $x2}
elseif (($x -ne '') -and ($x2 -ne '') -and ($x3 -ne ''))
{GenerateSymbolsForDatabase -Server $x -Database $x2 -ObjectFilter $x3}
else
{
[System.Windows.Forms.MessageBox]::Show("Please enter server and database. Object Filter is an option.")
Write-Error 'Please enter server and database. Object Filter is an option.'
}
}
GenerateSymbolsNAV
Tags: generatesymbolreference