1. Correction of imported data

    Article: AN0002442Updated: 19.09.2020

    Sometimes we need to correct imported data. This is faciliated by scripts running at import events.

    Elimination of particular import data

    We can define which data should be imported and which not and modify them if needed as late as at the import run itself. Below script stated in the Import in the field Start after data upload into the database causes that there are some data marked to be ignored in the temporary table containing data loaded from the import file. Such data will not be therefore imported in the end. The data to be ignored in the example have in column Initials value "NO" or do not have in column CanonicalName text "objectgears.com/_Active" or have in column CanonicalName text "objectgears.com/_Active/_Technical".

    var cl = OG.ClassDef.GetById( OGActualImport.ClassDefId);
    var colInitials = cl.Columns['Initials'];
    var colCanonicalName = cl.Columns['CanonicalName'];

    //set ignoring the records
    var sql = OG.TextUtils.Format( 'update {0} set iserror = 1 where col_{1}_s = \'NO\' OR col_{2}_s NOT LIKE \'%objectgears.com/_Active%\' OR col_{2}_s LIKE \'%objectgears.com/_Active/_Technical%\'', OGActualImportDbTable, colInitials.Id, colCanonicalName.Id);

    You can use the example for import of Active Directory user data that you obtained by function OG_AD-User.