How can I determine from the API if a property value is user entered?

Discussions concerning general integration topics.

Moderator: Phil Barton

Post Reply
BobRichards
Posts: 1376
Joined: Wed Jan 15, 2014 3:50 pm
Location: Raleigh, NC
Contact:

How can I determine from the API if a property value is user entered?

Post by BobRichards »

When I read the property from the API, it is zero. I need to determine if it is a user entered zero or if a rule determined the value.
Bob Richards, Senior Software Developer, SoftPro
BobRichards
Posts: 1376
Joined: Wed Jan 15, 2014 3:50 pm
Location: Raleigh, NC
Contact:

Re: How can I determine from the API if a property value is user entered?

Post by BobRichards »

In this example, we'll use a decimal value set to zero (i.e. Sales price). When the value of the order model property is read via API, it will return zero. But sometimes we care if the user manually entered a zero or if it came from a rule or formula. We can use an IOrderItem method to determine this. If GetIsCalculated() returns true, then the value is a result of a Formula, Custom Order Rule, or Select Order Model rule. Usually these "zeros" will not be display in the Select UI to avoid the screen appearing very busy.

Conversely, if the user typed a value into the cell thereby overriding rules, GetIsCalculated() returns false.

There is one variable type to be careful with. If the user enters data in a String property, GetIsCalculated() will return false (as expected). But if the user deletes all the characters in the field using Backspace, Delete, or Ctrl+X keys, GetIsCalculated() will still return false since you have effectively entered an empty string (string of length 0). The only way to restore the field to being calculated is to F2 the field.
Bob Richards, Senior Software Developer, SoftPro
Post Reply