SQL to update flex attribute

Can anyone help me with SQL where im trying to mass update the Flex attribute value(list type) to No. Since its using the same Yes/No list on multiple attributes, its not returning unique result to update

Agile User Asked on November 8, 2016 in Agile PLM (v9),   Product Collaboration.
Add Comment
7 Answer(s)

Hi Smitha,

what is the kind of object do you intend to mass update?
You can use the Import utility to do it, it’s a safer method.

Regards
Carlos

Agile Angel Answered on November 8, 2016.
Add Comment

Its a Part

I have started updating the attribute through OOTB import functionality. But there are 32k objects and i can load 500 objects at once as it takes time to get loaded and released.

Please suggest

Agile User Answered on November 8, 2016.
Add Comment

You can create a custom script using the Agile SDK instead of editing the Agile Database (it is a black box and everyiting is not documented neither supported by Oracle).


IItem myPart = session.getObject(IItem.OBJECT_TYPE, “1234”);
myPart.setValue(“Page Three.FlexFieldName”, “XXX”);

repeat it in a foreach with the numbers that you want to update and run it on the server in order to be faster than local for 32k items

Agile Angel Answered on November 8, 2016.
Add Comment

Thanks Carlos and Antonio for the suggestions. Appreciate it!!

Issue is Attribute is change controlled and can not be updated with out a Change Order. 🙁
Even if i write a custom script to update attribute,object needs to change order to redline the value

So i was looking for SQL to mass update in DB.

Agile User Answered on November 8, 2016.
Add Comment

if you are not interested to the redlining, you can disable the Change Control property to No for the time needed to run the script.
To update the DB you have also to take care to update the redlining info in the DB as well and it will not cover all stuff. This can create corrupted Changes and corrupted revisions that make your system instable. (32k corrupted items are very dangerous)

Agile Angel Answered on November 8, 2016.
Add Comment

So the question is more, do you simply want to change the attribute value, or do you want to also make sure that the change is noted by history and the change-control functionality??
 If all you want to do is change the value, it isn’t too hard. Build a table of all the item numbers (NEED_MOD) that need to be affected. Then run the following SQL :
update agile_flex set number1 = <list value ID> where attid = <flex attr ID> and id in (select id from item where item_number in (select item_number from NEED_MOD) );

 But I think Antonio’s suggestion (Groovy script) is much better. At a time when the system isn’t busy (or you can lock everybody out), modify the attribute to *not* be change-controlled, and use a script to make the changes through the Agile server. Then change the attribute back to being change-controlled. You automatically get a history record that way (ALWAYS a good thing) and you also don’t have to look everything up (list ID, attribute ID, etc.). Import would also be a good thing to use, although probably slower.

Also note that no matter how you plan on doing this, TEST IT FIRST in your Development or Test environment. I know the database schema rather well, and even I would not just simply run this in the Production environment. No matter what or how you are going to do this, TEST IT FIRST, so that you don’t accidentally screw things up (Been There, Done That, and had to clean it up). Using SQL to directly modify the database should be your last option, and only used if there is no other way to do what you need done.

Agile Angel Answered on November 8, 2016.
Add Comment

Thanks Kevin. Sure i will keep that in mind.

Update you all guys once im done with the update.

Thank you !! Appreciate it!!

Agile User Answered on November 9, 2016.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.