Examples mapping.ini

Aus IMPS
Zur Navigation springen Zur Suche springen
[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%
;Start workflow on a person and get the case id as result
_TMP_CASEID            = WebserviceCall Direct CaseStartPrcd "wMReqS" "1.0" "P" %_TMP_PERSID%

;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"
; Get Corsa objects by Query qrtDbField (system field) / qrtReference (reference field) with specified result list !!!ATTANTION MAYBE IT DOES NOT WORK ANY MORE!!!
;_TMP_PROCEED = WebserviceCall Direct QueryResult D [list [list qrtDbField dossier_id qcAnd qoEqual %_TMP_OBJECTID%]] -returnIDsOnly false -resultItems [list [list qrtReference] [list aNorm]] [list TypeValue [list { Type {} Value {} }] ]
; Get a List of registration fields with this:
= LogMessage "Registrationfields = [WebserviceCall Direct GetRegistrationFields D]"
; And get the fields with this:
_TMP_GetContact        = WebserviceCall Direct GetFields D %_TMP_FOLDERID% [list obj_obj.object_type obj_obj.object_id] [list aPNum]

[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"
; concat joins a list and single values to a new list; lsort removes double entries; join makes a string from the list; split replaces the default seperator with ValueSeperator Ⓥ. ValueSep has to be configured in the system.ini!!!
dCaseIDs     = split [ join [lsort -unique [concat %_TMP_NEWCASES% %_TMP_CASEOFFER% %dCaseID%]] [format %c 9419]]
;Workflowstart on a person
_TMP_WFID           = WebserviceCall Direct CaseStartPrcd "uVorBbfS" "1.0" P %VNR%
; Delete documents and unlink existing folders and cases before deleting
_TMP_DOCID            = Return %Doku.ID%
_TMP_CHK_FOLDER       = WebserviceCall Direct ObjectsOfObject "D" "Dokument" %_TMP_DOCID%
                      = LogMessage "Ordner von %_TMP_DOCID% = %_TMP_CHK_FOLDER%"
_TMP_DEL_FOLDER       = foreach _element %_TMP_CHK_FOLDER% { WebserviceCall Direct ModObjectRelation2 MORA_Delete S %_TMP_DOCID% D $_element }
_TMP_CHK_CASE         = WebserviceCall Direct ObjectsOfObject "C" "relPost" %_TMP_DOCID%
                      = LogMessage "Workflows von %_TMP_DOCID% = %_TMP_CHK_CASE%"
_TMP_DEL_CASE         = foreach _element %_TMP_CHK_CASE% { WebserviceCall Direct ModObjectRelation2 MORA_Delete S %_TMP_DOCID% C $_element }
_TMP_DELETED          = if {[WebserviceCall Direct DeleteObject "S" %_TMP_DOCID%] == 1}  {LogMessage "Dokumentenregistrierung %_TMP_DOCID% wurde gelöscht!"}

[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 %Dossiers% in the csv
LINKOBJECTTYPE         = Return D
LINKOBJECTIDS          = Return %Dossiers%
;You can create a folder with a given id when you set the object type numbering to manual in Corsa. Otherwise the folder id will be automatically generated by Corsa.
LINKOBJECTTYPE        = Return D
LINKOBJECTIDS         = WebserviceCall ::CreateObject::FolderByQuery Bouw "%Dossiers%" [list [list dossier.dossier_oms "%Dossier titel%"]] {} {}

[UPLOAD]
;Folder path must be set in front of the %Orgfile%. We do not generate a new version if the file when it is uniquely the same so always version 1 will be set.
NAT         = ErrorIfNotExists [file join "D:/stratoz/data/" %OrgFile%]  
NATVERSION  = Return 1
NATMODE     = Return 0

Upload the file which has the same name the csv has and always create a new version.
;NAT         = ErrorIfNotExists [file join %_FILENAME%]
;NATVERSION  = Return 0

;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 %"}