It's all about the answers!

Ask a question

RTC custom work item script-based validator for unique value


Darin Hodgson (152) | asked Jun 27 '17, 7:44 p.m.

I need to identify a method of ensuring a unique value in a small string attribute of a custom work item within Rational Team Concert (RTC).  Ideally, the simplest solution, such as a database column constraint, would be best.  However, a script-based validator for the attribute would be acceptable as well.  If a script-based validator is the best or only method to accomplish this desired action the actual code to implement this solution would be helpful.

Accepted answer


permanent link
Donald Nong (14.4k314) | answered Jun 27 '17, 9:26 p.m.

Script-based validators are based on, JavaScript. I would imagine it is painfully slow if you implement it this way. To ensure the uniqueness, you will have to retrieve all existing work items and compare the intended value with the existing values, which can take a long time.

A database unique index may not be easy to implement either because you cannot map the work item type to a table and the attribute to a column. Even you can somehow implement it, how to handle the database exception is another question - you want to capture the exception and throw a new error with your own message telling the users what's happening.

How should this unique value look like? Does a timestamp (in milliseconds) meet the requirement?

Darin Hodgson selected this answer as the correct answer

Comments
Darin Hodgson commented Jun 28 '17, 11:19 a.m.

Unfortunately, a timestamp (in milliseconds) would not meet the requirement.  I understand your response that since the JavaScript would need to "retrieve all existing work items and compare the intended value with existing values..." and that this would be time consuming.  Based on this information we'll not expend any more effort on using a script-based validator for the purpose of preventing a duplicate attribute value from being entered.  Instead, maybe we'll just attempt to train our users to look for the existence of the value before entering a new work item.  Thanks for the response.

One other answer



permanent link
Ralph Schoon (60.5k33643) | answered Jun 28 '17, 1:00 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Your answer


Register or to post your answer.