Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 3672 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Hello,

I have a simple if statement (simplified):

 

If [myTable::Value < 0]

    [result 1]

Else

    [result 2]

End If

 

The thing is, I get [result 2] even if Value is less than zero. The only thing I could think was that on the current layout Value is displayed as part of a text box (i.e. "Some text <<myTable::Value>> some more text"), but testing this by adding a field for Value doesn't seem to fix it.

I am completely stumped.

Posted

Is the myTable::Value field a number field, a text field, or something else? If it isn't a number field, using GetAsNumber ( myTable::Value ) instead may clear-up the issue.

Posted

It's a calculation with the result as a number.

 

I've sort of figured it out. Earlier in the script Value is used in a different IF statement, and after that Value is changed, and then the IF statement I'm having a problem with happens. I added a dialog pop up showing Value just before the problem IF statement and Value in the dialog box is the same as in the previous IF statement. In other words, Value is being cached when it gets looked up in the first IF and then the same (old and incorrect) value of Value is being used in the second IF statement. I know the changes to Value between the IFs are happening because I see them happen on the layout as I step through the script in Debug Mode.

 

So I guess my question now is how do I get the script to look up the value again instead of just re-using the old one?

 

e: Relookup Field Contents gives me an error dialog and Flush Cache to Disk doesn't work either.

Posted

Cool, putting a Commit Records before the second IF fixed it. Thank you, I would never have thought of that. I have never used Commit Records before, is it good practice to Commit Records after every manipulation step?

Posted

The other consideration is that, when on iOS, it is important NOT to commit a record needlessly since each commit sends all the record's fields back up to the server.  If a User is in the habit of clicking the layout as an act of committing, it can really slow things down. One can use a layout which prohibits commit (via button or web viewer over entire layout) and forcing a button 'save' action.  This stops repeated unnecessary record movement.

  • Like 1

This topic is 3672 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.