Mass Update Change Classes
Hi,
Does anyone know of a good way to conduct a mass, or bulk, update classes (ECOs, MCOs, etc.)? I’m looking to mass update the Reason Code for a bunch of old changes. I see that the regular import function allows me to update various fields on items and other objects, but not routable objects.
Has anyone tried this? Is there a way to import and bulk update the various data fields (attributes)?
-Matt
Agreed, the Import utility is of no use in this case. It can be used to create changes, but can only update them when one is still at Pending status. After that, Import will not modify a routable object. I won’t describe the following as a “good” way to do this, but it is certainly possible to use SQL*Plus to do this. Note that the Agile Software Warranty used to specifically prohibit doing this under penalty of the warranty being null and void (I don’t think Oracle does this anymore, but……). The schema *is* rather complex, but I am telling you the easiest way to do this.
I assume that you want to set all these old changes to the same Reason Code value? Note that REASON_CODE is a list attribute, and holds the ID of a single list value. So find a change has the value you want to set all the others to (if none currently do, create a new change and set it to that value). Use the below query to see the list ID for that value :
select reason_code from change where change_number='<chng num>’;
Then create a script that contains the following query for each change you want to modify :
update change set reason_code = <ID from above query> where change_number = ‘<old change #>’;
To generate a script the above can be automated by any number of means, and thus generate a script for a lot of changes fairly easily.
Stop the Agile application server. Open an SQL*Plus session into the Agile schema, open a spool file, and then run the script. Close the spool file, and log out of SQL*Plus. Then start the Agile application server, wait for it to start, and log in. You should see the new values in all of the changes that were modified. The stop/start of the application server *is* important as it uses a large memory cache, and if the data for an object is in the cache, you will see that rather than what is actually in the database (and therefore, not the value that you just changed).
You can create a script using Agile API that gets info from a csv file (or similar) and populate a map of attributes that can be set on each change
One final option, for anyone else who needs to do this, is by script. To answer my earlier question, I haven’t done it yet with to update the reason code, but I know it will be done with a very similar script.
import com.agile.agileDSL.ScriptObj.*;
import com.agile.api.*;
import com.agile.px.*;
import com.agile.util.sql.*;
import java.sql.*;
void invokeScript(IBaseScriptObj object) {
m_session = object.getAgileSDKSession();
IChange change1= (IChange)m_session.getObject(ChangeConstants.CLASS_ECO, “17-0120”);
change1.setValue(1557, “listvalue1”)
change1.comment(false, false, false, “Adding this comment to this ECO for historic record”)
IChange change3= (IChange)m_session.getObject(ChangeConstants.CLASS_ECO, “17-0126”);
change3.setValue(1557, “listvalue2”)
IChange change5= (IChange)m_session.getObject(ChangeConstants.CLASS_ECO, “17-0295”);
change5.setValue(1557, “listvalue1”)
}