Dear community,
Context:
We have developed a base model with the purpose of serving as a reporting service.
This uses a control procedure in the dynamic model - with the staged strategy - to do the following:
- Create a task, based on the parameters of a report that is present in the model
- Create a system flow that uses this task and its parameters.
The issue:
All in all, the base model works perfect.
However, when renaming a parameter on a report, it fails when generating the dynamic model code.
It gives the following error:
‘
The DELETE statement conflicted with the REFERENCE constraint "ref_process_variable_process_action_report_parmtr_input_parmtr". The conflict occurred in database "SF", table "dbo.process_action_report_parmtr_input_parmtr".
‘
The cause:
I believe that it is due to the fact that the update on the table dbo.process_action_report_parmtr_input_parmtr is performed after the delete on dbo.process_variable, thus not complying with its FK reference.
In the temporary table of process_action_report_parmtr_input_parmtr the process_variable_id is updated, thus no record of dbo.process_action_report_parmtr_input_parmtr is deleted where the OLD process_variable_id is used.
However, the OLD record in dbo.process_variable is deleted, before the record referencing this record (from dbo.process_action_report_parmtr_input_parmtr) is gone or updated.
See the (generated) dbo.process_variable delete:
See the error details (message is above):
We are using platform version 2024.2
Current workaround:
The current workaround is to ‘keep making’ the process variable records in the temporary table that are currently being used, even though they are not necessary to be used after the generation.
For example, there is a report ‘test’.
Which has a parameter ‘test_id’.
We rename this parameter to ‘test1_id’.
After generating we keep the process variable ‘test_id’, because of the issue above, while we also create the new variable ‘test1_id’ that serves the new purpose of carrying the value of the newly named parameter.
This works like a charm.
The question:
The fact that the process_variable records get deleted before the process action (report/fixed/normal) (input/output) parameters are updated caused this issue.
I took quite some time to debug, and the issue was ‘not really’ in the control procedure, but in what happens after the control procedure.
Is this ‘the way that the SF works’ or something that will be changed according to feedback/uses cases like these?
Or should we ‘keep these (types of) scenario's in mind’ when creating control procedures for dynamic modeling?
Please let me know your thoughts on this.