Warning - Computed When Composed - Recomputing

Okay, either I don’t understand CWC or there is a bug.

  1. Have a field called nTerms which is a number field, computed when composed.

  2. The value of this field is 0.

  3. Using a hotspot action to prompt for new values for this field.

Using this formula, the field was changing, and then immediately reseting to 0.

Result:=@Prompt([OkCancelEdit];“Terms”;“Please enter the number of days:”; “”);

@SetField(“nTerms”; Result);

@Command([ViewRefreshFields])

Leaving the ViewRefresh command off would allow one to see the new value, but hitting F9 would immediately change it back to 0.

Strangely, making the field a text field stopped this behavior. It would no longer recompute.

I suspected therefore that because prompt returns a string, that might be the issue. Therefore, changing the formula to this fixed the problem:

Result:=@Prompt([OkCancelEdit];“Terms”;“Please enter the number of days:”; “”);

Result:=@ToNumber(Result);

@SetField(“nTerms”; Result);

@Command([ViewRefreshFields])

BE ADVISED.