8
0

Import-FileContentToDB: Überarbeitung der Importlogik, Filterung von Sonderzeichen

This commit is contained in:
KammM 2024-10-14 11:22:46 +02:00
parent 9a2534faec
commit 49eefd4b7b
4 changed files with 15 additions and 73 deletions

View File

@ -1,5 +1,13 @@
-------------------------------------------------------------------------------
Version 2.1.0.0 - 11.10.2024
NEW: - Parameter call (
FIX: - Fixed CSV import issue, if inverted commas in data - other case
CHG: - " will be removed bevor inserting data, Code improvement
REM: -
-------------------------------------------------------------------------------
Version 2.0.1.0 - 10.06.2024
NEW: -
FIX: - Fixed CSV import issue, if inverted commas in data

View File

@ -143,7 +143,7 @@ DBConnString = "Data Source=S-ZLSDMS-DB1\;Initial Catalog=DD_ECM\;User Id=DD_ECM
# If you need to run the Script with dynamic Values, you can do so, by calling it with arguments. #
# Even the Special and Optional Parameters are available in this case. #
# Example: #
# This Function is currently not implement! #
# Import-FileContentToDB.ps1 -argProfileID 1 #
####################################################################################################
####################################################################################################
@ -162,7 +162,7 @@ DBConnString = "Data Source=S-ZLSDMS-DB1\;Initial Catalog=DD_ECM\;User Id=DD_ECM
# CheckSQL = <SQLQuery> #
#--------------------------------------------------------------------------------------------------#
# First Parameter: <Command> #
# Set the first SQL Query, this query will only be run once per file. #
# Set the first SQL Query. #
# Example: DELETE FROM [DD_ECM].[dbo].[TABLE] #
####################################################################################################
@ -172,7 +172,7 @@ DBConnString = "Data Source=S-ZLSDMS-DB1\;Initial Catalog=DD_ECM\;User Id=DD_ECM
# InitialSQL = <SQLQuery> #
#--------------------------------------------------------------------------------------------------#
# First Parameter: <Command> #
# Set the second SQL Query, this query will only be run once per file. #
# Set the second SQL Query. #
# Example: DELETE FROM [DD_ECM].[dbo].[TABLE] #
####################################################################################################
@ -182,7 +182,7 @@ DBConnString = "Data Source=S-ZLSDMS-DB1\;Initial Catalog=DD_ECM\;User Id=DD_ECM
# PreparingSQL = <SQLQuery> #
#--------------------------------------------------------------------------------------------------#
# First Parameter: <Command> #
# Set the third SQL Query, this query will only be run once per file. #
# Set the third SQL Query. #
# Example: DELETE FROM [DD_ECM].[dbo].[TABLE] #
####################################################################################################
@ -207,7 +207,7 @@ DBConnString = "Data Source=S-ZLSDMS-DB1\;Initial Catalog=DD_ECM\;User Id=DD_ECM
# Example: DELETE FROM [DD_ECM].[dbo].[TABLE] #
####################################################################################################
Profile = ExcelImport ; %CellValue% ; E:\FileProcessing\Input\File\DocumentKindAssigned\XAP_Adressstammdaten\*.xlsx ; utf7 ; 4 ; 5 ; 999999999 ; XAP__Stammdaten_Adressen(2) ; E:\FileProcessing\Output\File\DocumentKindAssigned\XAP_Adressstammdaten ; E:\FileProcessing\Output\File\DocumentKindAssigned\XAP_Adressstammdaten
Profile = ExcelImport ; %CellValue% ; E:\FileProcessing\Input\File\DocumentKindAssigned\XAP_Adressstammdaten\*.xlsx ; utf7 ; 4 ; 5 ; 999999999 ; XAP ; E:\FileProcessing\Archive\File\DocumentKindAssigned\XAP_Adressstammdaten ; E:\FileProcessing\Output\File\DocumentKindAssigned\XAP_Adressstammdaten
PreparingFile =
CheckSQL =
InitialSQL = DELETE FROM [DD_ECM].[dbo].[TBCUST_XAP_KUNDENSTAMM]
@ -215,7 +215,7 @@ PreparingSQL =
MainLoopSQL = INSERT INTO [DD_ECM].[dbo].[TBCUST_XAP_KUNDENSTAMM]([Kundennummer],[Objektnummer],[Versorgungsart],[rAdressart],[rAnrede],[rNAME1],[rNAME2],[rStraße],[rHausnummer],[rPostfach],[rPLZ],[rOrt],[rTelefon],[rMail],[vAdressart],[vAnrede],[vNAME1],[vNAME2],[vStraße],[vHausnummer],[vPostfach],[vPLZ],[vOrt],[vTelefon],[vMail],[ADDED_WHO],[ADDED_WHEN]) SELECT '%column1%','%column2%','%column3%','%column4%','%column5%','%column6%','%column7%','%column8%','%column9%','%column10%','%column11%','%column12%','%column13%','%column14%','%column15%','%column16%','%column17%','%column18%','%column19%','%column20%','%column21%','%column22%','%column23%','%column24%','%column25%','Import-FileContentToDB',getdate()
FinalSQL =
Profile = CSVImport ; %CellValue% ; \\s-zls22\Somentec\XAP-Mandanten\XAPPROD\Archiv\*.csv ; utf7 ; 3 ; 4 ; 999999999 ; \^\,\^|\^ ; \\s-zls22\Somentec\XAP-Mandanten\XAPPROD\Archiv\DMS-Eingelesen ; \\s-zls22\Somentec\XAP-Mandanten\XAPPROD\Archiv\DMS-Fehler
Profile = CSVImport ; %CellValue% ; \\s-zls32\XAP\XAP-Daten\ZLS\ZLS_WASS\XAP_ZLS_WASS_P\ARC\*.csv ; utf7 ; 3 ; 4 ; 999999999 ; \^\,\^|\^ ; \\s-zls32\XAP\XAP-Daten\ZLS\ZLS_WASS\XAP_ZLS_WASS_P\ARC\DMS-Eingelesen ; \\s-zls32\XAP\XAP-Daten\ZLS\ZLS_WASS\XAP_ZLS_WASS_P\ARC\DMS-Fehler
PreparingFile = Replace(@FOLDER,FT:^HKA-IMP^~,~HKA-IMP)
CheckSQL =
InitialSQL =
@ -232,7 +232,7 @@ FinalSQL =
#MainLoopSQL = INSERT INTO [DD_ECM].[dbo].[TBCUST_XAP_KUNDENSTAMM]([Kundennummer],[Objektnummer],[Versorgungsart],[rAdressart],[rAnrede],[rNAME1],[rNAME2],[rStraße],[rHausnummer],[rPostfach],[rPLZ],[rOrt],[rTelefon],[rMail],[vAdressart],[vAnrede],[vNAME1],[vNAME2],[vStraße],[vHausnummer],[vPostfach],[vPLZ],[vOrt],[vTelefon],[vMail],[ADDED_WHO],[ADDED_WHEN]) SELECT '%column1%','%column2%','%column3%','%column4%','%column5%','%column6%','%column7%','%column8%','%column9%','%column10%','%column11%','%column12%','%column13%','%column14%','%column15%','%column16%','%column17%','%column18%','%column19%','%column20%','%column21%','%column22%','%column23%','%column24%','%column25%','Import-FileContentToDB',getdate()
#FinalSQL =
#Profile = CSVImport ; %CellValue% ; \\s-zls22\Somentec\XAP-Mandanten\XAPPROD\Archiv\*.csv ; utf7 ; 3 ; 4 ; 999999999 ; \^\,\^|\^ ; \\s-zls22\Somentec\XAP-Mandanten\XAPPROD\Archiv\DMS-Eingelesen ; \\s-zls22\Somentec\XAP-Mandanten\XAPPROD\Archiv\DMS-Fehler
#Profile = CSVImport ; %CellValue% ; \\s-zls32\XAP\XAP-Daten\ZLS\ZLS_WASS\XAP_ZLS_WASS_P\ARC\*.csv ; utf7 ; 3 ; 4 ; 999999999 ; \^\,\^|\^ ; \\s-zls32\XAP\XAP-Daten\ZLS\ZLS_WASS\XAP_ZLS_WASS_P\ARC\DMS-Eingelesen ; \\s-zls32\XAP\XAP-Daten\ZLS\ZLS_WASS\XAP_ZLS_WASS_P\ARC\DMS-Fehler
#PreparingFile = Replace(@FOLDER,FT:^HKA-IMP^~,~HKA-IMP)
#CheckSQL =
#InitialSQL =

View File

@ -1,66 +0,0 @@
21.02.2024-16:07:42:
21.02.2024-16:07:42: ********************************************************************************
21.02.2024-16:07:42: Program Startup: MoveOrCopy-Files on SDD-VMP03-VM07,
21.02.2024-16:07:42: from Account DD-SAN01\Administrator.
21.02.2024-16:07:42: ********************************************************************************
21.02.2024-16:07:42:
21.02.2024-16:07:42: Found 1 MountProfile(s) to process.
21.02.2024-16:07:42:
21.02.2024-16:07:42: --------------------------------------------------------------------------------
21.02.2024-16:07:42: This is MountProfile: 1 of 1
21.02.2024-16:07:42: --------------------------------------------------------------------------------
21.02.2024-16:07:42: Configured RemotePath is: \\dd-pc-ent04\e$\KammM
21.02.2024-16:07:42: Configured LocalPath is: T
21.02.2024-16:07:42: Configured Username is: dd-gan\Administrator
21.02.2024-16:07:42: Trying to connect to: \\dd-pc-ent04\e$\KammM,...
21.02.2024-16:07:42: ... now connected to T
21.02.2024-16:07:42: --------------------------------------------------------------------------------
21.02.2024-16:07:42:
21.02.2024-16:07:42: There is/are 1 out of 99 Rule(s) to process, starting now.
21.02.2024-16:07:42:
21.02.2024-16:07:42: ===========================================================================================
21.02.2024-16:07:42: Processing MOCF_Profile01 now.
21.02.2024-16:07:42: ===========================================================================================
21.02.2024-16:07:42:
21.02.2024-16:07:42: These Values are setup: move *.pdf E:\Testordner\input true writetest t:\test.
21.02.2024-16:07:42:
21.02.2024-16:07:42: This run, searches for *.pdf -Files in Folder: E:\Testordner\input
21.02.2024-16:07:42: Checking Path E:\Testordner\input for existence.
21.02.2024-16:07:42: Path E:\Testordner\input is already existence and can be used.
21.02.2024-16:07:42: Searching reclusive in E:\Testordner\input\*
21.02.2024-16:07:42: Could find some File(s) - 1 - in Path: E:\Testordner\input\* (regard on White and Black Lists) ...
21.02.2024-16:07:42:
21.02.2024-16:07:42: -------------------------------------------------------------------------------------------
21.02.2024-16:07:42: Processing file: E:\Testordner\input\PDF Document (neu).pdf
21.02.2024-16:07:42: -------------------------------------------------------------------------------------------
21.02.2024-16:07:42:
21.02.2024-16:07:42: Filesystem infos about this item (maybe important for final path):
21.02.2024-16:07:42: Attributes: Archive
21.02.2024-16:07:42: CreationTime Attribute: 02/21/2024 16:07:35
21.02.2024-16:07:42: LastAccessTime Attribute: 02/21/2024 16:07:35
21.02.2024-16:07:42: LastWriteTime Attribute: 02/21/2024 16:07:35
21.02.2024-16:07:42:
21.02.2024-16:07:43: This ist Try Number: 1 of 1000
21.02.2024-16:07:43: to handle file: E:\Testordner\input\PDF Document (neu).pdf
21.02.2024-16:07:43:
21.02.2024-16:07:43: Checking if file: E:\Testordner\input\PDF Document (neu).pdf is locked...
21.02.2024-16:07:43: Checking if file: E:\Testordner\input\PDF Document (neu).pdf is readable.
21.02.2024-16:07:43: Checking if file: E:\Testordner\input\PDF Document (neu).pdf is writeable.
21.02.2024-16:07:43: File E:\Testordner\input\PDF Document (neu).pdf checked with result: writeable
21.02.2024-16:07:43: Checking Path t:\test for existence.
21.02.2024-16:07:43: Path t:\test is already existence and can be used.
21.02.2024-16:07:43:
21.02.2024-16:07:43: The File (PDF Document (neu).pdf) already exists in the target directory, starting Version Check.
21.02.2024-16:07:43: The move command has been completed.
21.02.2024-16:07:43: File was renamed to: PDF Document (neu)~9.pdf, and is now transferd to: t:\test.
21.02.2024-16:07:43: ===========================================================================================
21.02.2024-16:07:43:
21.02.2024-16:07:43: -------------------------------------------------------------------------------------------
21.02.2024-16:07:43: Checking LogFiles:
21.02.2024-16:07:43: -------------------------------------------------------------------------------------------
21.02.2024-16:07:43: Log Files should be removed which are older than 30 Day(s).
21.02.2024-16:07:43: Deleting no old LogFiles.
21.02.2024-16:07:43:
21.02.2024-16:07:43: *******************************************************************************************
21.02.2024-16:07:43: Program Finish: MoveOrCopy-Files on SDD-VMP03-VM07 from Account DD-SAN01\Administrator.
21.02.2024-16:07:43: *******************************************************************************************