Task CompareFieldValue with > or <

MagicTimm

Member
Hi, what should I change ?

Original code:
return fieldValue.Equals(compareValue.GetValue()) ? TaskStatus.Success : TaskStatus.Failure;

it should be like this. I changed the SharedString to ShareInt, but it's alway an error (cannot operator >= to SharedInt)
if (fieldValue >= compareValue)
TaskStatus.Success;
else
TaskStatus.Failure;
 
You'll need to get the field value and then cast that to an int to be able to compare.
 
Yes, but I failed to do that. Because the fieldname is a sharedString I cannot use ToInt or else. I tried it since 2 h to solve this.
Found something like this, but nothing works....
public static int IntParseFast(string value)
{
int result = 0;
for (int i = 0; i < value.Length; i++)
{
char letter = value;
result = 10 * result + (letter - 48);
}
return result;
}
 
I done it like this:

int actualValue = int.Parse(fieldValue.ToString());
int minimumValue = int.Parse(compareValue.GetValue().ToString());

return actualValue >= minimumValue ? TaskStatus.Success : TaskStatus.Failure;
 
Top