AnsweredAssumed Answered

Related Calculation failing on restart...

Question asked by ppillard on Feb 21, 2019
Latest reply on Feb 22, 2019 by ppillard

I have a weird bug (or problem).


I have the following calculation functioning in a database (or did, at least):

ValueCount (JobSiteHazards) + ValueCount ( FilterValues ( List (SOP::HazSlipTrip);MonitoredHazardFlag )) + ValueCount (EnvironmentalHazards) - 1


JobSiteHazards is a checkbox value list, as is EnvironmentalHazards.

SOP::HazSlipTrip is a related field in a table in a completely separate database.


Basically, the calculation monitors the value of JobSiteHazards, EnvironmentalHazards, and the occurrences of SOP::HazSlipTrip and totals it all together to give me a score on one particular hazard (in this case SlipTrip).


I'm seeing some serious weirdness and I suspect it's because I don't have things assigned as variables correctly. I converted the calculation to a script so I could see what is going on and I have found the following quirks:


1.) JobSiteHazards is always reporting a value of 1 greater than it should (thus the arbitrary '-1' at the end of the above calc. It's a hackjob workaround as I figure this all out.


2.) All values of EnvironmentalHazards is *appearing* to be ignored.  The script reports that the value EnvironmentalHazards is ALWAYS zero, despite having multiple items checked within it.  However, the end result is always right, because the checkbox value (per the script) shows up within the JobSiteHazards variable and therefore cloaks the problem (this is what make me suspect I have variable handling issues).


3.) and the biggest problem: When I initially build the above calculaltion, it works beautifully, even considering the hackjob of subtracting one to limp along.  However, the poop hits the fan when I shut down the database and re-launch it.  When I do that, I lose all related data from SOP::HazSlipTrip (as well as the 9 other calculations that are doing basically the exact same thing, only they monitor a different name of hazard), and no amount of swearing or begging will re-establish the link.  If I had any hair on my head, I would pull it out.


This is the second time I've built this. Initially, I thought I had some sort of database corruption and I attempted to recover, which failed, then I restored from the nights previous back up.  I thought that fixed it when I rebuilt and all seemed to be working well.  Then, I restarted filemaker to activate my debugger and that's when the problem made itself apparent.   I have a strong suspicion this is rooted in my own inexperience.


I recognize that this is a pain to describe and likely a lot more a pain to muddle through on your end.Please let me know and I will try to clarify as best I can.  Any help would be greatly appreciated.