AnsweredAssumed Answered

When entering Find Mode, AE calc in related table fires?

Question asked by justinc on May 15, 2017
Latest reply on May 15, 2017 by Philip_Jaffe

I noticed an odd issue recently with an auto-enter calculation that I have on a field.

 

I'm using FMPA 15.03 on a file hosted on FMS 15.01.

 

The general structure that is relevant here has two tables:       Projects, ProjectMembers

Related by:     Projects::ID = ProjectMembers::ProjectID_fk

 

A "Project" can have many different "ProjectMembers".  There's a field - "ProjectMembers::Sort_cont" - that has the auto-enter calc that appears to be the problem I am wondering about.  This field is part of a drag-and-drop feature, and so it has a number of global variables that are defined in this AE calc.

 

The problem that I have noticed is that when this file opens, it runs through a Startup script that, of course, initializes a few fields, etc.  During this Startup process, it goes to a layout based on the 'Projects' table and does a Find for all 'active' Projects.  The odd part is that when it does this Find, as soon as it enter's Find Mode, the AE calc on the related "ProjectMembers" is somehow firing - and it sets all these global variables (7 of them).

 

The variables aren't a problem, really - except from the standpoint of clutter.  I don't want them to be set at this stage.  Here are the steps from the Startup script where the problem occurs:

 

Go To Layout ["Script Use Projects"] (Projects)

...

Set Error Capture (On)

Enter Find Mode (pause: off)

Set field [ Projects::Active = 1 ]

New Record

Omit record

set field [ Projects::List = 1 ]

Perform Find

 

The g-vars get set when it runs the 'Enter Find Mode' step.  This layout has nothing on it - no fields, no layout objects, nothing.  After it enters Find Mode, the Data Viewer doesn't even report that it's in an active field ("get(activefieldname)" is empty).  And yet it has processed this AE calc in this related table/record(s).

 

So...how is this AE calc getting triggered?  I'm guessing that it is part of some pre-fetch/caching process.  This appears to be one of those oddities about FM that I don't have a solid grasp of yet - how it pre-fetches related tables/records/data.  Which is frustrating because, as in this case, it appears to trigger calculations and data transfers that could slow the system down.  It really shouldn't be triggering this calculation at all, I would say.

 

And it's a container field - this would imply to me that it has not only transferred this related record (probably many - however many might be related to this "Project" record), but it has downloaded this related-record's container field data.  In this case the container holds only a small amount of data, but what if I had large images stored in container(s) on this related record?  Is it downloading all of that, too?  (As far as I am aware, FM tries to be smart and NOT download container data unless it is actually rendered - but that doesn't appear to be the case here.  Unless the AE calc is somehow separated from the data in the container-contents.)

 

Thanks,

Justin

Outcomes