Saturday, November 30, 2013

Update Java Extension ClassName for Configurator CX rules using query

Following query will update the java classname (from to ) for all the models which are under repository folder name 'Models - In Process'

UPDATE cz_rules ru
SET ru.class_name        = ''
WHERE exists(SELECT folder_name, model_name,
  p.devl_project_id, rule_name,
FROM cz_rules r,
  cz_devl_projects p,
  cz_rp_entries rpp,
  cz_rp_entries rpf
WHERE r.devl_project_id=p.devl_project_id
AND r.rule_type = 300 -- CX rules
AND rpp.object_id       =p.devl_project_id
and rpp.enclosing_folder = rpf.object_id
AND rpp.object_type     ='PRJ'
AND R.DISABLED_FLAG=0  --update only enabled rules
AND rpf.object_type = 'FLD'
--AND P.DEVL_PROJECT_ID=1037298 --add this if you want to update specific model only
AND class_name LIKE ''
AND RPF.NAME LIKE 'Models – In Process'
AND r.rule_id=ru.rule_id