FieldRef.VALIDATE (Rec & xRec)

naffnaff Member Posts: 32
Hi,

I'm trying to use a FieldRef to change a value of some field of some record.
First I am writing the new value to my FieldRef using the EVALUATE function. Then I run the VALIDATE function to make sure my code in the OnValidate-Trigger will also run.

So far this works, but now I have the problem that inside the OnValidate trigger my xRec already holds the new value instad of the old. So a condition like Rec.Description <> xRec.Description will not work.

Any ideas how to handle this?
I need the EVALUATE, because I do not know what type the value is. But I also need the OnValidate trigger to be fired correctly (with xRec containing the old value and Rec containing the new).
EVALUATE(FieldRef,XmlNode.InnerText,9);
FieldRef.VALIDATE;

Best Answer

Answers

  • naffnaff Member Posts: 32
    Ok, I think I found a solution.
    But I am not satisfied. It seems to be more complicated than neccessary. But right now I couldn't come up with something better.
    FieldRef := RecRef.FIELD(FieldID);
    RecRef2 := RecRef.DUPLICATE;
    FieldRef2 := RecRef2.FIELD(FieldID);
    EVALUATE(FieldRef2,XmlNode.InnerText,9);
    FieldRef.VALIDATE(FieldRef2.VALUE);
    
  • naffnaff Member Posts: 32
    EVALUATE(FiedRef.VALUE,...) doesn't compile.
    I thought about the possibility to create a variable for each type, but since every type is possible this would be a much bigger case statement than my code above. I'll probably just have to go with that.

    Thank you again for your feedback, vaprog.
Sign In or Register to comment.