14. Dezember 2017 17:31
pageextension 70000002 pageextension70000002 extends "Bank Account Card"
{
// version NAVW111.00,MyExt01
actions
{
addafter("Bank&konto")
…
tableextension 70000009 tableextension70000009 extends "Cust. Ledger Entry"
{
// version NAVW111.00,MyExt01
keys
{
key(Key1;"Customer No.","Document No.")
{
}
key(Key2;"Customer No.",Open,"Document Date")
{
}
key(Key3;Open,"Customer No.","Document Date")
{
}
}
}
[string]$MyEnviron = [Environment]::OSversion.Version.ToString(3) ; [bool]$OldEnviron = ($MyEnviron.substring(0,3) -eq '6.1')
$ParentWorkingFolder = "C:\MyFolder"
IF (!(Test-Path $ParentWorkingFolder)) {New-Item $ParentWorkingFolder -type directory}
IF (!(Test-Path $ParentWorkingFolder\ORIGINAL)) {New-Item $ParentWorkingFolder\ORIGINAL -type directory -force}
IF (!(Test-Path $ParentWorkingFolder\MODIFIED)) {New-Item $ParentWorkingFolder\MODIFIED -type directory -force}
IF (!(Test-Path $ParentWorkingFolder\DELTA)) {New-Item $ParentWorkingFolder\DELTA -type directory -force}
Import-Module "${env:ProgramFiles(x86)}\Microsoft Dynamics NAV\110\RoleTailored Client\Microsoft.Dynamics.Nav.Model.Tools.psd1" -force -DisableNameChecking | out-null
$IndexFolder = "$ParentWorkingFolder\TEMPINDEX"
IF (Test-Path $IndexFolder) {Remove-Item $IndexFolder\*.txt -recurse}
Export-NAVApplicationObject -DatabaseServer MyServer -DatabaseName MyDatabase -ExportToNewSyntax -path $ParentWorkingFolder\OPPobjectsNewSyntax.txt -Filter "Version List=*OPP*" -ExportTxtSkipUnlicensed -Force
Split-NAVApplicationObjectFile -Source $ParentWorkingFolder\OPPObjectsNewSyntax.txt -Destination $ParentWorkingFolder\MODIFIED -Force
Export-NAVApplicationObject -DatabaseServer MyServer -DatabaseName MyDatabase -path $ParentWorkingFolder\BaseAppObjects.txt -Filter 'ID=..49999;"Version List=*OPP*"' -ExportTxtSkipUnlicensed -Force
Split-NAVApplicationObjectFile -Source $ParentWorkingFolder\BaseAppObjects.txt -Destination $ParentWorkingFolder\TEMPINDEX -Force
Get-ChildItem -Path $IndexFolder\*.txt |
ForEach-Object `
(
{
Write-host "Trying to export object:" $_.Name
$IDbasename = [System.IO.Path]::GetFileNameWithoutExtension($_.Name)
$IDobject = $IDbasename.Substring(3)
$ShortObjectType = $IDbasename.Substring(0,3)
$IDobject = "ID=" + $IDobject
Switch ($ShortObjectType)
{"TAB" {$ObjectFilter = "Type=Table;" + $IDobject + '"'}
"PAG" {$ObjectFilter = "Type=Page;" + $IDobject + '"'}
"REP" {$ObjectFilter = "Type=Report;" + $IDobject + '"'}
"XML" {$ObjectFilter = "Type=XMLport;" + $IDobject + '"'}
"COD" {$ObjectFilter = "Type=Codeunit;" + $IDobject + '"'}
"MEN" {$ObjectFilter = "Type=MenuSuite;" + $IDobject + '"'}
"QUE" {$ObjectFilter = "Type=Query;" + $IDobject + '"'}}
$ExportFile = $_.Name
$LogFile = "$ParentWorkingFolder\ORIGINAL\Log_$ExportFile"
$ExportFile = "$ParentWorkingFolder\ORIGINAL\$ExportFile"
if (Test-Path "$ParentWorkingFolder\navcommandresult.txt") {Remove-Item "$ParentWorkingFolder\navcommandresult.txt"}
if (test-path $ExportFile) {remove-item $ExportFile}
if ($OldEnviron) {$NAVFolder = '"C:\Program Files (x86)\Microsoft Dynamics NAV\110\RoleTailored Client'} else {$NAVFolder = 'C:\Program Files (x86)\Microsoft Dynamics NAV\110\RoleTailored Client'}
$exportfinsqlcommand = """$NAVFolder\finsql.exe"" command=ExportToNewSyntax,file=$ExportFile,servername=MyServer,database=MyDatabase,Logfile=$LogFile"
if ($ObjectFilter -ne ""){$exportfinsqlcommand = "$exportfinsqlcommand,filter=$ObjectFilter"}
$Command = $exportfinsqlcommand
Write-Debug $Command
cmd /c $Command
$ExportFileExists = Test-Path "$ExportFile"
If (-not $ExportFileExists) {
write-error "Error on exporting to $ExportFile. Look at the information below."
if (Test-Path "$ParentWorkingFolder\navcommandresult.txt"){Get-Content "$ParentWorkingFolder\navcommandresult.txt"}
if (Test-Path $LogFile) {Get-Content $LogFile}
}
else{
$NAVObjectFile = Get-ChildItem $ExportFile
if ($NAVObjectFile.Length -eq 0) { Remove-Item $NAVObjectFile }
if (Test-Path "$ParentWorkingFolder\navcommandresult.txt") {Get-Content "$ParentWorkingFolder\navcommandresult.txt"}
}}
)
if (Test-Path "$ParentWorkingFolder\ORIGINAL\navcommandresult.txt") {Remove-Item "$ParentWorkingFolder\ORIGINAL\navcommandresult.txt"}
IF (Test-Path $IndexFolder) {Remove-Item -path $IndexFolder\*.txt -recurse}
IF (Test-Path $IndexFolder) {Remove-Item -path $IndexFolder}
$NAVFolder = "${env:ProgramFiles(x86)}\Microsoft Dynamics NAV\110\RoleTailored Client"
Compare-NAVApplicationObject -DeltaPath $ParentWorkingFolder\DELTA -ModifiedPath $ParentWorkingFolder\MODIFIED -OriginalPath $ParentWorkingFolder\ORIGINAL -Force -IgnoreDocumentation
$Convertcommand = """$NAVFolder\txt2al.exe"" --source=""$ParentWorkingFolder\DELTA"" --target=""$ParentWorkingFolder\AL"" --rename"
$Command = $Convertcommand
Write-Host -ForegroundColor Green 'Convert objects with:'
Write-host -ForegroundColor Gray " $Command"
cmd /c $Command
24. April 2018 17:43
2. Mai 2018 16:14
9. August 2018 12:07
Kowa hat geschrieben:Da bei Txt2Al.exe seit der Bereitstellung viele Bugs gefunden und behoben wurden, hierfür ein aktuelles Image verwenden.
16. Dezember 2021 19:19
Kowa hat geschrieben:Hier neue Schlüssel in Tabelle 21 Cust. Ledger Entry (falls übrigens wie hier ausschließlich neue Schlüssel das DELTA bilden, kann man das Objekt gleich wieder löschen, denn solche werden vom SQL-Server nicht mehr benötigt und der AL-Compiler stuft diese als Fehler ein).