Wednesday 19 April 2017

Duplicate Start Center Template | IBM Maximo

1. Create a new empty Start Center Template, Save and write down sctemplateid.

Now run these SQL queries and modify source and targetIds:

update MAXIMO.SCTEMPLATE
set presentation=(SELECT presentation FROM MAXIMO.SCTEMPLATE where      sctemplateid=<SourceID>)
where sctemplateid=<TargetID>;

update SCTEMPLATE set PRESENTATION=replace(PRESENTATION,'startcenter contentuid="<sourceID>"','startcenter contentuid="<TargetID>"'), where sctemplateid=<new SCTEMPLATEID>;



you are done :)

Or we can this below mentioned select statement to duplicate all Start Centers from OLD to NEW, it will give us a list of update statements to run in sequence, or for better we should create a sql scripts.

SELECT
'update MAXIMO.SCTEMPLATE set presentation=(SELECT presentation FROM MAXIMO.SCTEMPLATE where sctemplateid='||SRC.sctemplateid || ' where sctemplateid='||DST.sctemplateid||';' QUERY1
,'update SCTEMPLATE set PRESENTATION=replace(PRESENTATION,'|| ''''||'startcenter contentuid="'||SRC.contentuid||'"'||',''startcenter contentuid="'||DST.contentuid||'"'||''') where sctemplateid='||DST.sctemplateid||';' QUERY2
  FROM (SELECT S.* FROM SCTEMPLATE S WHERE S.DESCRIPTION LIKE 'OLD%') SRC,
    (SELECT S.*  FROM SCTEMPLATE S WHERE S.DESCRIPTION LIKE 'NEW%') DST
 WHERE SUBSTR(SRC.DESCRIPTION,4,LENGTH(SRC.DESCRIPTION)) = SUBSTR(DST.DESCRIPTION,4,LENGTH(DST.DESCRIPTION));

below is the result of this command (vary in each case) QUERY1, QUERY2, which contains a list of UPDATE STATEMENTS to BE execute one by one or by creating script to run all at once.

Query1 Result: update MAXIMO.SCTEMPLATE set presentation=(SELECT presentation FROM MAXIMO.SCTEMPLATE where sctemplateid=68 where sctemplateid=318;
Query2 Result: update SCTEMPLATE set PRESENTATION=replace(PRESENTATION,'startcenter contentuid="SCTMPLT67bbfcd4",'startcenter contentuid="SCTMPLTd66503ab"') where sctemplateid=318;


reference: http://maximodeploy.blogspot.com/2017/04/duplicate-start-center-template-ibm.html

2 comments:

  1. Thank you for sharing such an informative article. I really hope I can see other interesting posts. Keep up the good work!


    Melbourne Web Developer

    ReplyDelete
  2. Hi, when running the 1st update statement (update MAXIMO.SCTEMPLATE
    set presentation = (SELECT presentation FROM MAXIMO.SCTEMPLATE where sctemplateid = <149>)
    where sctemplateid = <530>) i get the "missing expression" error.I am running it on Oracle SQL Developer

    ReplyDelete