Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X
Hi, I want to copy the data of a field A to field B for a big number of items. Both fields are part of the same item. The batch copy action should be performed for all items that are found for a certain query. Can this be done be a command line option? Can you help me on that, since I am not familiar with command line options yet. Thanks!
Timo
Solved! Go to Solution.
Hi Timo,
A scheduled trigger is likely what you want. Set the trigger type to "Manual" and then on the query tab, you can select the query that returns all the items to run against. You will have to create a trigger script to facilitate the copy from one field to another.
Essentially:
//Gets the arguments for schedule trigger
stb = bsf.lookupBean("imScheduleTriggerArgumentsBean");
//This gets list of issues return by configured query
itemIds = stb.getIssues();
You would then just have to loop through the itemIds, copying the value from Field1 to Field2 and performing the required error checking. There should also be an option on either Serverbean or EnvironmentBean to "commit" your transaction...I would recommend you do that every 50-100 items - so they don't remain "locked" and inaccessible to other users. (Also a good idea to run it during off-peak hours)
For more info see the "Event Trigger Java Documentation" available on your Integrity Server's homepage. (Open <server host>:<port> in a web browser.
Hope this helps!
-Andrew
Hi Timo,
A scheduled trigger is likely what you want. Set the trigger type to "Manual" and then on the query tab, you can select the query that returns all the items to run against. You will have to create a trigger script to facilitate the copy from one field to another.
Essentially:
//Gets the arguments for schedule trigger
stb = bsf.lookupBean("imScheduleTriggerArgumentsBean");
//This gets list of issues return by configured query
itemIds = stb.getIssues();
You would then just have to loop through the itemIds, copying the value from Field1 to Field2 and performing the required error checking. There should also be an option on either Serverbean or EnvironmentBean to "commit" your transaction...I would recommend you do that every 50-100 items - so they don't remain "locked" and inaccessible to other users. (Also a good idea to run it during off-peak hours)
For more info see the "Event Trigger Java Documentation" available on your Integrity Server's homepage. (Open <server host>:<port> in a web browser.
Hope this helps!
-Andrew
Hi Andrew, thanks for your help. I will try your solution the next time I do have to copy lots of fields. This time I solved it by copying manually everything in a 3-hours session 😞 But next time I will spend some time in this trigger script.
Timo