Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X
OIR question.
At my current client location, they have a wc10.1 OIR disable at container level issue.
For whatever reason, they have like 50 containers with 10 different OIR's.
They now want to override & disable those 50 or so, with 10 new ORG level
OIR's, that they will loadfromfile create.
Obviously they dont want to manually select disable for 500 OIR's from the interface.
I'll assume that you cant change the container level OIR's to disabled
through loadfronfile, but I could be wrong.
Does anybody know the route to diable those. LoadFromFile, coding, ???
Thanks
L Jett
Update:
We are upgrading from 9.1 to 10.1.
We tried the diable container level OIR route through loadfromfile enable="false", as in loadfromfile snippet below:
<organizationconfig>
<typebasedrule>
<enginerule isdefault="false" enabled="<strong">false">
<rulename>Test OIR</rulename>
<rulespecification> <attributevalues objtype="wt.doc.WTDocument|<type">">
.........
But the false did not work on an existing OIR. But if you manually delete the OIR 1st,
then run the same loadfromfile with false on, it creates & is disabled.
Just wont work on existing.
We have a call in to ptc support & they mentioned possible code on wc9.1 to delete the OIR. Thats not a preference,
but well accept what we can get. But we are waiting.
If anyone has working loadfromfile &/or source to disable or delete, it would be very helpful.
L Jett
Good idea Dave,
I did a little research on the sql side:
Randy is right. The sql is trivial, I would suggest:
update TYPEBASEDRULE set ENABLEDFLAG = '1' where NAME in ('<an_oir_name_here>', '<another_oir_name_here>', '<etc>');
However, I noticed in our system, the ENABLEDFLAG field has values of 0,1or 2. So before making the change in production, I would suggest that someone determine the difference between the intended use of 1 and 2 in a test system. Lawrence has suggested he would try this first on a vmware image. I would be interested in knowing what the difference between the Flag values is.
Yes, I was already using:
UPDATE TYPEBASEDRULE SET enabledFlag='0' WHERE IDA2A2='6460';
But I ran into an issue. I had read or assumed that the enableFlag would either be 0 or 1.
I am finding values other than those. I will research.
L Jett
I found values other than 0,1,2. Some 100,200,300 plus.
The odd part is that on the dev box, they are all 0 & enabled.
On the vmware, they are 0-399, with no consistancy.
I at first that it would be 0 or 1 for org level. Then maybe 0 or 200 for product xyz, 0 or 300 for library abc.
No dice. All over the place.
Still researching...
L Jett
I did that. Disable.
For "? CN OIR", it changed the enableFlag to 361.
I thought OK, when I change the "? CA OIR", it will also be 361. Nope. 362. I actually figured it would be different.
I would assume that when I go back & change it to enable, it will go back to 0.
Opps, what happens when you assume with PTC &/or Windchill, you make an azzOfPTC....sorry Jeff....ha..ha
Let me go check that.
L Jett
Enabled both & they went back to 0.
For the heck of it, I disabled to see if it would go back to either 361 or 362.
It went to 363. Incremental.
Now I should run the sql code & change it to 1 & see what it does. See if it disables or freaks out.
It does seem the the "wt.inf.container.ExchangeContainer" ones are all 0 or 1.
Where the 356 is container level (product/Library).
More research/testting.
L Jett
Here is the updated code, so I/others can query the classes/methods later.
I use /**/ instead of tabs (before each line), so its more legible & wont word wrap oddly in your editor:
package ext;
import java.io.*;
import java.text.*;
import java.sql.*;
import java.net.*;
import java.util.*;
import java.lang.*;
import java.sql.PreparedStatement;
import wt.pds.DatabaseInfoUtilities;
import wt.pds.PDSIfc;
import wt.pom.*;
import wt.util.WTException;
import wt.fc.collections.*;
public class OIR_Disable_01 {
/**/public static void main(String args[]) {
/**//**/Statement statement;
/**//**/ResultSet resultset;
/**//**/statement = null;
/**//**/resultset = null;
/**//**/try {
/**//**//**/statement = connection.createStatement();
/**//**//**/String s,s1,s2,s3;
/**//**//**/idStg=";
/**//**//**/for(resultset = statement.executeQuery("Select Name, CLASSNAMEKEYCONTAINERREFEREN, IDA2A2, ENABLEDFLAG from TYPEBASEDRULE WHERE CLASSNAMEKEYCONTAINERREFEREN='wt.inf.container.OrgContainer' AND ENABLEDFLAG='0"); resultset.next();) {
/**//**//**//**/s = resultset.getString("Name");
/**//**//**//**/s1 = resultset.getString("CLASSNAMEKEYCONTAINERREFEREN");
/**//**//**//**/s2 = resultset.getString("IDA2A2");
/**//**//**//**/s3 = resultset.getString("ENABLEDFLAG");
/**//**//**//**/idStg = idStg+s2+",";
/**//**//**//**/System.out.println((new StringBuilder()).append("\nName: ").append(s).append("\n\tContainer: ").append(s1).toString());
/**//**//**//**/System.out.println((new StringBuilder()).append("\tIDA2A2: ").append(s2).append("\n\tENABLEDFLAG: ").append(s3).toString());
/**//**//**/}
/**//**//**/idStgFull = idStg.substring(0,idStg.length()-1);
/**//**//**/System.out.println("idStgFull: "+idStgFull);
/**//**//**/String ps1;
/**//**//**/ps1 = (new StringBuilder()).append("UPDATE TYPEBASEDRULE SET enabledFlag=1 WHERE IDA2A2 in (").append(idStgFull).append(")").toString();
/**//**//**/System.out.println("SQL Update Stg: "+ps1);
/**//**//**/preparedstatement = connection.prepareStatement(ps1);
/**//**//**/preparedstatement.executeUpdate();
/**//**//**/connection.commit();
/**//**/}
/**//**/catch(SQLException sqlexception1) {
/**//**//**/System.out.println("SQLException while executing startQuery: "+sqlexception1);
/**//**//**/sqlexception1.printStackTrace();
/**//**/}
/**//**/try {
/**//**//**/if(resultset != null)
/**//**//**//**/resultset.close();
/**//**//**/if(statement != null)
/**//**//**//**/statement.close();
/**//**//**/if(preparedstatement != null)
/**//**//**//**/preparedstatement.close();
/**//**/}
/**//**/catch(SQLException sqlexception) {
/**//**//**/System.out.println("SQLException while executing startQuery: "+sqlexception);
/**//**//**/sqlexception.printStackTrace();
/**//**/}
}
/**/static Connection connection;
/**/static PreparedStatement preparedstatement;
/**/static String idStgFull, idStg;
/**/static {
/**//**/try {
/**//**//**/connection = DataServicesRegistry.getDefault().getPdsFor("DEFAULT").getDataSource().getConnection();
/**//**/}
/**//**/catch(Throwable throwable) {
/**//**//**/throw new ExceptionInInitializerError(throwable);
/**//**/}
/**/}
}
Basically the sql is:
Select Name, CLASSNAMEKEYCONTAINERREFEREN, IDA2A2, ENABLEDFLAG from TYPEBASEDRULE WHERE CLASSNAMEKEYCONTAINERREFEREN='wt.inf.container.OrgContainer' AND ENABLEDFLAG='0'
Take IDA2A2's into array & use in Update sql.
UPDATE TYPEBASEDRULE SET enabledFlag=1 WHERE IDA2A2 in (0001,0002)
L Jett
The last code was good for testing & printing query before run.
The code below might be a more direct Update sql route, where you dont need to log.
Again using /**/ instead of tab for clarity. Just find/replace /**/ with tabs or ?
package ext;
import java.io.*;
import java.text.*;
import java.sql.*;
import java.net.*;
import java.util.*;
import java.lang.*;
import java.sql.PreparedStatement;
import wt.pds.DatabaseInfoUtilities;
import wt.pds.PDSIfc;
import wt.pom.*;
public class FMCNA_OIR_Disable_02 {
/**/public static void main(String args[]) {
/**//**/try {
/**//**//**/String ps1 = ("UPDATE TYPEBASEDRULE SET enabledFlag=1 WHERE CLASSNAMEKEYCONTAINERREFEREN='wt.inf.container.OrgContainer' AND ENABLEDFLAG='0");
/**//**//**/System.out.println("SQL Update Stg: "+ps1);
/**//**//**/preparedstatement = connection.prepareStatement(ps1);
/**//**//**/preparedstatement.executeUpdate();
/**//**//**/connection.commit();
/**//**/}
/**//**/catch(SQLException sqlexception1) {
/**//**//**/System.out.println("SQLException while executing startQuery: "+sqlexception1);
/**//**//**/sqlexception1.printStackTrace();
/**//**/}
/**//**/try {
/**//**//**/if(preparedstatement != null)
/**//**//**//**/preparedstatement.close();
/**//**/}
/**//**/catch(SQLException sqlexception) {
/**//**//**/System.out.println("SQLException while executing startQuery: "+sqlexception);
/**//**//**/sqlexception.printStackTrace();
/**//**/}
/**/}
/**/static Connection connection;
/**/static PreparedStatement preparedstatement;
/**/static {
/**//**/try {
/**//**//**/connection = DataServicesRegistry.getDefault().getPdsFor("DEFAULT").getDataSource().getConnection();
/**//**/}
/**//**/catch(Throwable throwable) {
/**//**//**/throw new ExceptionInInitializerError(throwable);
/**//**/}
/**/}
}
L Jett
Or straight sql:
UPDATE TYPEBASEDRULE SET enabledFlag=1 WHERE CLASSNAMEKEYCONTAINERREFEREN='wt.inf.container.OrgContainer' AND ENABLEDFLAG='0';
commit;