Question

Is there a way to use form fields that does not correspond to database field for temporary processings?

I.e. I want to add:

  • temp fields item1, item2
  • database field sum
  • button with record hook that sets sum = item1 + item2
Was it helpful?

Solution

As far as I know it's simply not possible with ClearQuest. I've tried to do something similar and was told by our IBM consultant that the only way is to create a DB field for all variables.

OTHER TIPS

You can't attach data to form fields really - those are representations of the underlying data, not something scripts interact with directly.

Adding temporary data to the underlying record (entity) itself sounds unlikely as well. Perhaps it's possible to abuse the perl API and dynamically attach data to entity objects but I personally wouldn't try it, you're liable to lose your data at the whim of CQ then ;-)

That does not however mean it's impossible to have temporary data. The best way seems to me to be using the session object, which is explicitly intended for that purpose.

From the helpfile:

IBM Rational ClearQuest supports the use of sessionwide variables for storing information. After you create sessionwide variables, you can access them through the current Session object using functions or subroutines, including hooks, that have access to the Session object. When the current session ends, all of the variables associated with that Session object are deleted. The session ends when the user logs out or the final reference to the Session object ceases to exist.

There's some helpful documentation on this subject in file:///C:/Program%20Files/Rational/ClearQuest/doc/help/cq_api/c_session_vars.htm (Presuming a default installation on a windows machine, of course.)

Translating the code example in there into what you seem to be wanting, first you store the data you have calculated inside the session object:

$session->SetNameValue("item1", $value1);
$session->SetNameValue("item2", $value2);

Then in your calculation hook you retrieve the stored values and set the value of that totals field like this:

my $item1 = GetNameValue("item1");
my $item2 = GetNameValue("item2");
my $sum = $item1 + $item2;

$entity->SetFieldValue("some_totals_record", $sum);

Adjust to taste of course ;-)

ClearQuest schema designers often include 'temporary' fields in their record types. They do this so they perform operations on hooks to generate another value.

For example, for the Notes fields, there is a 'temporary' Notes_entry field that the user types the most recent note into, and when the record is saved, the value is added to the Notes_Log field. The next time the record is edited the Notes_entry field is cleared so the user can type a new Notes_entry.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top