I inherited a project about a month ago and I am trying to get through its code to understand how it works.
Overview: The project imports data from two local text files into local tables, processes the data to make it more compatible with other systems we use, then the data is uploaded to a database on our Filemaker server.
The database and scripts were put together in FM 8.5 but work just fine in FM 11. I have not tried to port them over to FM12 yet but that may happen soon.
The problem is that I have carefully stepped through the scripts to find the exact line where the data is moved up to the server, but the context doesn't make any sense. Here are the lines of code that I have identified as relevant to the process:
# This just creates a window; it does nothing to affect context as far as I can tell.
New Window [Name: "Import"; Height: 50; Width : 50]
# List_View is a local layout containing the data to be moved to the server and its context is OD_Panel_Process. OD_Panel_Process is a table in the local database--not on the server.
Go to Layout ["List_View" (OD_Panel_Process)]
# These next two commands are more administrative than actually productive, but I include them because you would want to know.
Show All Records
Replace Field Contents[yada yada]
# Here's the command. It moves the data from the OD_Panel_Process table in OnLInePanelFeed_Rename.fp7
# to the OD_Data table in the CD_Panel database on the server. But nowhere do I see a command to force the data
# to the CD_Panel database.
Import Records [No dialog; "OnLInePanelFeed_Rename.fp7"; Add; Mac Roman]
As far as I can tell, the "to" table should be the context table of the List_View layout, which is OD_Panel_Process, a local table. Yet I have verified that the data is placed in the server table when the Import Records command is executed.
Now, looking at the Relationships graph, I note that there is a relationship between OD_Panel_Process and the table occurrence OD_Data_Record_Check, an alias for OD_Data. There is also another relationship between the same tables through two intermediary table occurrences.
Does Filemaker do some kind of strange magic when an Import command is executed and two tables are related? That's the only thing I can think of, but I cannot find any in-depth documentation that discusses it.