Data Management handle project finished running
If you only want to know how to determine if a project has finished running go to Step 2: determine when a project has finished executing.
In a Data Management project there might be several entities in which data is to be inserted. Knowing when all these entities have finished executed is not straight forward. A customer wanted to post a journal automatically that was created by a Data Management project.
In this example I will explain how to mark a journal for posting and posting the journal created [via Data Management] after the project has finished executed.
Step 1: mark the journal for posting
In my case it looked like this:
[DataEventHandler(tableStr(PDIJournalTableEntity), DataEventType::Inserted)]
public static void PDIJournalTableEntity_onInserted(Common sender, DataEventArgs e)
{
PDIJournalTableEntity journalEntity = sender;
InspPDIJournalTableToPost::insertToPost(journalEntity);}
Step 2: determine when a project has finished executing
[DataEventHandler(tableStr(DMFDefinitionGroupExecutionHistory), DataEventType::Inserted)]
public static void DMFDefinitionGroupExecutionHistory_onInserted(Common sender, DataEventArgs e){DMFDefinitionGroupExecutionHistory executionHistory = sender;DMFDefinitionGroupExecutionHistory checkExecutionHistory;DMFDefinitionGroupEntity definitionGroupEntity;//TODO: add parameter for definition groupif(executionHistory.DefinitionGroup == 'PDI Journal'){select count(RecId)from definitionGroupEntitywhere definitionGroupEntity.DefinitionGroup == executionHistory.DefinitionGroup&& definitionGroupEntity.Disable == NoYes::No;select count(RecId)from checkExecutionHistorywhere checkExecutionHistory.DefinitionGroup == executionHistory.DefinitionGroup&& checkExecutionHistory.ExecutionId == executionHistory.ExecutionId&& checkExecutionHistory.StagingStatus == DMFBatchJobStatus::Finished&& checkExecutionHistory.TargetStatus == DMFBatchJobStatus::Finished;if(definitionGroupEntity.RecId == checkExecutionHistory.RecId){//indicates that all entities in the import project has runned successfullyInspPDIJourPostAsync inspPDIJourPostAsync = InspPDIJourPostAsync::construct();inspPDIJourPostAsync.run();}}}
Comments
Post a Comment