Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Pre-requisite: User needs to have access to the database to execute the SQL query

Steps:

  1. Import the workflow for at least one CP from the user interface. Image RemovedQuery for collection protocol identifiers for which the workflow is to be set from the database table catissue_collection_protocol.using UI as below.Image Added
  2. Below SQL sets the workflow set for CP using UI (whose ID is 1) to other CPs (CP1, CP2, CP3, CP4)

    select IDENTIFIER from
    Code Block
    languagesql
    titleget_CP_ID
    MySQL
    update 
      os_cp_workflows dst 
      inner join os_cp_workflows src on src.cp_id = 1 
    set 
      dst.workflows = src.workflows 
    where 
      dst.cp_id in (
        select
          identifier 
        from 
          catissue_collection_protocol 
        where SHORT_TITLE 
          short_title in ('CP1', 'CP2', 'CP3', 'CP4');
    >>31 32
    34
    37
  3. Use the output of the above SQL for the below SQL

  4. Below SQL sets the workflow set for 'AB Lung Cancer Trial' CP to the CPs with identifiers 31, 32, 34 and 37
     );


    update
    Code Block
    languagesql
    titlecp_workflow_update
    Oracle
    merge into
      os_cp_workflows a inner join dst
    using (
      select
        src.cp_id, src.workflows
      from
        os_cp_workflows src
    b) on b(src.cp_id = 1)
    when matched then
      update 
        set adst.workflows = bsrc.workflows 
      where 
        a.CP_IDdst.cp_id in (
          select
            identifier 
          from 
            catissue_collection_protocol 
          where 
            short_title in (31,32,34,37);'CP1', 'CP2', 'CP3', 'CP4')
        )