Introduction
When the form is attached at all CPs and the data entry is already done in multiple CPs. Follow the below steps to move the form from all CPs to a specific set of CPs i.e CPG without loss of data.
Steps
Scenario: The ‘Visit Form' attached at the ‘Visit Forms’ level to 'all CPs’ moved to ‘Common workflow’ CPG.
1. The ‘Visit Form' attached at the 'Visit Forms’ level to all CPs.
Log in to the database and run the SQL query to get the context id of the form which is attached at all CPs.
You can get the form name form the UI. Form list view → click on the form name → Copy form name.
The user will get the (identifier) form context id of form as shown in the below image.
2. Delete the form attachment from all CPs.
Form list view → click on the setting icon → click on dustbin icon → Done.
3. Attach the form at the CPG.
Go to the CPG → Form Tab → Visit → Forms +Add → select the form(attached to all CPs).
4. Run the below SQL for CP ids in the CPG and new context ID of the form which is attached at the CPG.
You will get the new context ids and CP ids as shown in the below image.
You can see the three entries of IDENTIFIER and CP_ID which means the CPG contains these three CPs to which the form is attached.
5. Run the SQL for the count of records under each CPs. This is the count of record (data entry) in each CP. Once you run the update SQL from #6 you will get a count of affected rows. The count from #6 step should match with the count of this step.
6. Run the SQL for updating the context id with a comparison of old context id.
You will get the new context id, CP id from #4 step, and old context id from #1 steps. You can check the rows affected after running the SQL and cross verify the count from #5 step.
Go back to the UI, You can see the form is attached to only specific CPs which are part of CPG.
Also, you can verify the data in each CP to which the form is attached.
For more details about the DB table refer to http://dbschema.openspecimen.org/