AnsweredAssumed Answered

Best way to solve a looping problem

Question asked by ahcho on Feb 22, 2012
Latest reply on Feb 23, 2012 by philmodjunk


Best way to solve a looping problem



I have the following tables/relationships:



Site::__kp_SiteID = Messages::_kf_SiteID

The messages table also has a field called "Read" which is automatically set to "No".

Here's what I want to do...I want to create a conditional button that is active only if there is a message for the specific site. Pressing the button will bring up a dialog window and change the color of the font from red to green in the button.

I've figure out the conditional formatting but run into a problem when there is more than one message that is related to the site. Theoretically, after reading the first message, the button should still be red since there is still a message in the table related to that record.

Now I originally thought that the program would automatically pick up the extra message but that's not the case (it looks like FM stops at the first entry that is related to the site). Adding a script with with Refresh Window() and Commit Records doesn't do anything either.

Part of me thinks that I need to implement a Loop that goes through the entire table to see if there is another related record but before I go through the process of figuring out the logic, is there another solution to this problem?