Jump to content
Juan Linares

Help with Debugging an old report generating script

Recommended Posts

Juan Linares

Good Morning Everyone, Im a relatively new Filemaker user at my current workplace and i have been tasked with debugging a script that generates a report. I am having issues with debugging this script report generator since the previous employee before me left without leaving any documentation about how he had designed script and i am trying to fix this script as i teach myself how to master Filemaker and how to troubleshoot, what are some recommendations you guys would have for someone trying to debug issues with a script?

I am familiar with the Script Debugger and the data viewer, but i would like to know what are some excellent strategies recommended to be more efficient with troubleshooting any weird values or inconsistencies i notice within the script's report generation.

Share this post


Link to post
Share on other sites
AHunter3

Hard to know without more details.  There are ten zillion ways of running a report, especially if we include all the weird and confusing and convoluted ways that someone might have come up with.

 

Many FileMaker reports rely on aggregate dataThat is to say that if your individual records were records of students, and each student was enrolled in a specific class, a report could be written that would show each class and how many students were in it.  Or, for that matter, how many students in each class were receiving an "A" for the semester and how many were getting a "B".  That's called a subsummary report and you can recognize it by the fact that the script sorts the data and the layout that it goes to — if you look at it in layout mode and open up Part Setup — will have Subsummary parts.

Many FileMaker reports rely on a scripted Find, including but not limited to subsummary reports.  The script will perform a Find, perhaps restoring a Find Request or perhaps going into Find Mode and setting fields to various calculated values and then performing that find.  

A variation on the scripted Find is to Go to Related Records in the script, using the definition of a relationship to isolate the specific records that are to be reported on.

Many FileMaker report scripts pause for user interaction, most often to vary what is found and hence reported on.  

 

But there are other very different kinds of reports.  Some are designed so that calculation fields in the layout pull the correct information when global fields that anchor relationships are set within the report script.  Some are designed so that information is harvested and held onto in some fashion (perhaps by setting $variables to temporary values) and then "answers" are written out as the report.  And there can be all manners of additional actions you don't see in the report script that may play a role in the report, such as script triggers causing other scripts to fire.

 

There are also many different ways a report script can be misbehaving.  With our without an error message popping up?  Is a report being generated but it's just wrong, or is the report failing to happen?  If it has wrong numbers, how do you know they're wrong?  Can you assess the same data in a series of manual operations to get the right answers?

 

 

 

 

Share this post


Link to post
Share on other sites
Juan Linares

Let me give a bit more context, The report that stems from the script i am working on serves the purpose of creating a report that houses an entire list of students and their entire up to date status on all of their finances with the school i am working at. This report houses a students remaining balance if they took out any student loans, their total current amount of available funds in grants, what amount they have left in dollars to pay of their loans,  and any other financial charges that are typically charged to a student.

From what i have understood from looking at the script, Each of these record fields gets filled one at a time for all students first, before moving onto the next field for populating.

These fields get populated from the script by pulling information from other layouts, the script copies a student ID from the reports layout that already houses basic student info like student name,id,and program, this same layout will also house all of the complete records after the script fills them up with the missing information.

The weird thing about the script is that it works perfectly fine for a majority of records, the script copies a student id from the main layout, and goes to another layout, enters find mode, pastes the student id for searching, and searches for any financial history the student has tied to their student id on that financial history layout.

If a financial transaction is found, that value will be copied and pasted onto the main layout in its respective field that we will be populating for our report, if no records are found, then that particular field will be populated with a zero by the script.

For some reason, the script "sometimes" populates bogus values when it fails to find any kind transactions tied to the student id, instead of populating the said fields with a zero as intended, i am assuming there may be an issue with the script when a find occurs with certain student ID's but i am not sure how i should go about trying to break this script apart to find how these issues spawn. would it help if i provided a screen shot of the script?

Share this post


Link to post
Share on other sites
AHunter3

If it's really using Copy and Paste to move data around, one thing to keep in mind is that if you perform a Find that results in zero records found, and then you issue a Copy command, that does not blank out your clipboard.  Instead, the command is ignored.  So if you went and pasted you would paste whatever had previously been copied, instead.

But it's a badly written script if it's using Copy and Paste.  I won't say I never ever under any circumstances use Copy and Paste, but I can sure go a decade or so between times when I've used them in FileMaker.  I'm going to suppress my instinct to tell you to rewrite it from scratch though.

I understand enough from what you've described to get a general sense of the script.  It's "going out there" (to different layouts, different tables) and "harvesting" data which it then writes (by having copied and now, pasting) to the fields that are on the report.  I'd say:  try to isolate one of the situations where it populates bogus values.  See if you can make it do that (to repeat the occurrence of that) as opposed to it seeming to happen at random.  That will be a strong clue, if you can pin down a situation where it happens repeatably, dependably, then pick it apart to find out more precisely how and why that is happening.

 

 

  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

Terms of Use