Community

CheckSucceeded, ErrorMessage with Suggest not functional, was functional in FC9

in FC9 I had both dropdown Suggest and an errormessage in the field. Below is something similar to what use to work. But it now either flags all rows in the table or gives error message in the table, if you try and use both. I'm trying to find a work around or fix.


var x = Field("Qty").Value;
var y = Field("UnitPrice").Value;
var z = Field("Amount").Value;
var amount = x*y

if (z==amount.toFixed(2)){
this.Field("Amount").IsMatched;
CheckSucceeded = true;
}
else
CheckSucceeded = false;
ErrorMessage = "Amount is not matched"
Suggest( amount.toFixed(2));

Was this article helpful?

0 out of 0 found this helpful

Comments

3 comments

  • Avatar
    Permanently deleted user
    Hello,

    Here are some corrections made at a first glance:

    var x = Field("Qty").Value;
    var y = Field("UnitPrice").Value;
    var z = Field("Amount").Value;
    var amount = x*y
    if (z==amount.toFixed(2)){
    this.Field("Amount").IsMatched; //what is it supposed to do? .IsMatched is a read-only bool property. you are not doing anything with its value here==useless code
    CheckSucceeded = true;
    }
    else {
    //I suppose brackets missing here? without them 2 and 3 lines after else will always be executed
    CheckSucceeded = false;
    ErrorMessage = "Amount is not matched"
    Suggest( amount.toFixed(2));
    }


    Please let me know if this code won't work still.

    Best regards,
    Vladislav
    0
  • Avatar
    Permanently deleted user
    Ah ok, I see what was happening. Let me try your edits. That makes a lot of sense.
    0
  • Avatar
    Permanently deleted user
    I have it working now. My issue was that the object field in a function was not populated to other functions and therefore the error message had no where to go. Thanks for your help.
    0

Please sign in to leave a comment.