Examples mapping.ini: Unterschied zwischen den Versionen

Aus IMPS
Zur Navigation springen Zur Suche springen
Zeile 57: Zeile 57:
 
   
 
   
 
  [UPLOAD]
 
  [UPLOAD]
  ;Folder structure must be set to the path of %Orgfile%. We do not generate a new version if the file is the same so always version 1 is set.
+
  ;Folder structure must be set to the path of %Orgfile%. We do not generate a new version if the file is the same so always version 0 is set.
 
  NAT        = ErrorIfNotExists [file join "D:/stratoz/data/" %OrgFile%]   
 
  NAT        = ErrorIfNotExists [file join "D:/stratoz/data/" %OrgFile%]   
  NATVERSION  = Return 1
+
  NATVERSION  = Return 0
;Use the next available version
 
 
  NATVERSION  = Return 0
 
  NATVERSION  = Return 0
 
  NATMODE    = Return 0
 
  NATMODE    = Return 0
Zeile 66: Zeile 65:
 
  NATDSACTION = subst "-action NONE"
 
  NATDSACTION = subst "-action NONE"
 
   
 
   
  ;You can directly import the archive, ocr and thumbnail files if you already have them
+
  ;You can directly import the archive, ocr and thumbnail files if you already have them. BUT Corsa will overwrite them if it is configured in the CMC. If you activate "Generate TXT from PDF" in PDF Creation the OCR file will always be overwritten!
 
  ARC        = ErrorIfNotExists %ArcFile%
 
  ARC        = ErrorIfNotExists %ArcFile%
 
  OCR        = ErrorIfNotExists %OcrFile%
 
  OCR        = ErrorIfNotExists %OcrFile%

Version vom 10. Juli 2017, 12:33 Uhr

[GLOBAL]
; Pay attention Technically the reading process is 1. System fields 2. Reference fields and then global fields
OBJECTID        = %Document Id%
OBJECTID        = Return %_TMP_OBJECTID%
OBJECTKIND      = Return "Retroactum"
OBJECTKIND      = Return %Stuksoort code%
;Actually supported S, D, V, C, E, P
OBJECTTYPE      = Return S 

[SYSTEMFIELDS]
;Generate a Unique ID (SHA256) for the document
_TMP_PROT              = LogMessage "Creating Unique ID for [file join \"D:/stratoz/data/\" %OrgFile%]"
_TMP_UniqueID          = ::sha2::sha256 -hex -filename [file join "D:/stratoz/data/" %OrgFile%]
;In most cases you will have the full path to the import file in the csv. So simply use this instead of the above.
_TMP_PROT              = LogMessage "Creating Unique ID for %OrgFile%"
_TMP_UniqueID          = ::sha2::sha256 -hex -filename %OrgFile%

;Create the document if not present (based on the unique id which will be checked against Corsa) yet, otherways get a new doc id from Corsa
; WebserviceCall ::CreateObject::DocumentByQuery <ObjectKind> <ObjectId> <Query> <SystemFieldsList> <ReferenceFieldsList>
_TMP_OBJECTID          = WebserviceCall ::CreateObject::DocumentByQuery %Stuksoort code% *DUMMY* [list [list qrtReference dUnique qcAnd qoEqual %_TMP_UniqueID%]] [] [list [list dUnique %_TMP_UniqueID%]]
;You will need this if you want to delete the newly created object when an error occours during the import process
_TMP_objectCreated   = CheckDefinition $::mapping::objectCreated

; Setting the system fields
poststuk.reg_datum     = Return %Registratie datum%
poststuk.onderwerp     = Return %Onderwerp%
obj_doc.naam           = Return %Bestandnaam%
poststuk.afgehandeld   = Return %Afg% 

;Set current timestamp
poststuk.dat_poststuk  = clock format [clock seconds] -format "\x25\d/\x25\m/\x25\Y"

[REFERENCEFIELDS]
;Here are differences in the source data and Corsa field, so an adjustment from CSV Data to Corsa data is needed to ensure correct spelling.
bouwdsr      = string map {Aanvraag "01 - Aanvraag" Vergunning "02 - Vergunning" Tekening "03 - Tekening" Overige "04 - Overig"} %Bouw document soort%
;Set the Unique ID and an Import Type Version
dUnique      = Return %_TMP_UniqueID%
;If you have the document id in your CSV you can generate the sha here instead of above.
dUnique      = ::sha2::sha256 -hex -filename %OrgFile%
dVersion     = Return "R2C 1.0"

[VARTAB]

[LINKS]
;Real Estate 
LINKOBJECTTYPE         = Return V
LINKOBJECTIDS          = Return %Vastgoed%
;Imports a list of Vastgoed = "ID00001,ID00002"
LINKOBJECTIDS          = split %Vastgoed% \,

;Folder is linked to the id which is present in the csv
LINKOBJECTTYPE         = Return D
LINKOBJECTIDS          = Return %Dossiers%
;Folder can be created if Foldertype is set to manual so we can set the folder id. Otherwise the folder can be created automaticly and linked to this document registration.
LINKOBJECTTYPE        = Return D
LINKOBJECTIDS         = WebserviceCall ::CreateObject::FolderByQuery Bouw "%Dossiers%" [list [list dossier.dossier_oms "%Dossier titel%"]] {} {}

[UPLOAD]
;Folder structure must be set to the path of %Orgfile%. We do not generate a new version if the file is the same so always version 0 is set.
NAT         = ErrorIfNotExists [file join "D:/stratoz/data/" %OrgFile%]  
NATVERSION  = Return 0
NATVERSION  = Return 0
NATMODE     = Return 0
;CORSA won't do a job to create archiv- OCR- or thumb !RESEARCH!
NATDSACTION = subst "-action NONE"

;You can directly import the archive, ocr and thumbnail files if you already have them. BUT Corsa will overwrite them if it is configured in the CMC. If you activate "Generate TXT from PDF" in PDF Creation the OCR file will always be overwritten!
ARC         = ErrorIfNotExists %ArcFile%
OCR         = ErrorIfNotExists %OcrFile%
TMB         = ErrorIfNotExists %TmbFile%

[POSTIMPORT]

[OK]

[ERROR]
;If you do not use a unique id to identify the object, you should delete the object when an error occours during the import process and import again when problems are fixed!
CMD          = if {%_TMP_objectCreated%} {WebserviceCall Direct DeleteObject "%OBJECTTYPE%" "%_TMP_OBJECTID %"}