How to stop updating existing records while imporitng

Hi All,

I have requirement that I have file based integration through DMF, I have primary key for data entity and as per the standard DMF functionality whenever we are importing if the record already exist , importing will update the existing one.

My requirement is that if record already exist DMF should stop updating it and it should continue the execution for rest of the records.

Please suggest if any.

One of possible solutions is setting the DB operation to None if it’s Update. For example:

public void mapEntityToDataSource(DataEntityRuntimeContext _entityCtx, DataEntityDataSourceRuntimeContext _dataSourceCtx)
{
	super(_entityCtx, _dataSourceCtx);

	if (_dataSourceCtx.getDatabaseOperation() == DataEntityDatabaseOperation::Update)
	{
		_dataSourceCtx.setDatabaseOperation(DataEntityDatabaseOperation::None);
	}
}

Thank you very much Martin, after overriding the above method I am able to stop updating the record.

But in both cases we can see in DMF status as updated the record though stopped it.
Thank you very much

Hi Martin,

After stopping the update I want to show error log in DMF as this particular record as duplicate…

if you have nay suggestions on were should I write the code please suggest…

What if you throw an exception instead of setting the operation to None?

Hi Martin,

I tried to throw error message like record already exist hen the DB operation is update…

It shows the error but still the import completed successfully without error, I can see the execution log with my error message

public void mapEntityToDataSource(DataEntityRuntimeContext _entityCtx, DataEntityDataSourceRuntimeContext _dataSourceCtx)
{
// super(_entityCtx, _dataSourceCtx);

    if (_dataSourceCtx.getDatabaseOperation() == DataEntityDatabaseOperation::Update)
    {
      //  //_dataSourceCtx.setDatabaseOperation(DataEntityDatabaseOperation::None);

        error ("data already exist");

    }
    next mapEntityToDataSource( _entityCtx,  _dataSourceCtx);
}

}

Please suggest if any…

Your code doesn’t throw an exception - it merely adds an error message to infolog and then let the record to update. You would need throw error(...) instead.