Data Viewer extensions in MBS Plugin

Let us show you nine features of MBS FileMaker Plugin around the data viewer in FileMaker. While all are available on macOS, only one is also available on Windows:

Toggle data viewer

To show or hide the data viewer, just run MBS("Menubar.RunMenuCommand"; 49297) to trigger the menu command. Of course you need a menu set where this command is included and sufficient permissions.

You can define a hotkey via MBS FileMaker Plugin to show an hide the data viewer via a keyboard shortcut on macOS and Windows:

Set Variable [$hotkey; Value:MBS("HotKey.Register"; "F5"; "control")]
Set Variable [$r; Value:MBS( "HotKey.SetEvaluate"; $hotkey; "MBS(\"Menubar.RunMenuCommand\"; 49297)" )]

You may also use our Toolbar functions or even the TouchBar functions to define a custom button to toggle the data viewer.

Find text

For macOS we have a search feature for various lists in FileMaker. We add it to the OS control used by FileMaker (NSTableView and NSOutlineView classes), so it appears in all places within the application independent of whether FileMaker may have its own search feature.

Click on the title bar of the data viewer window to bring the focus to it. A colored line frames the list of variables. Now press ⌘F to show the search bar.

Type something and press return key to jump to the next one. Repeat the return key or ⌘G to move to the next one.

You can click Done button to close the search panel if needed. it will show again if you press ⌘F. Since we reuse the find bar if possible, your old search string may still be there.

Zoom

When you have focus on the list (colored line around), you can press command key with plus to zoom in:

Key Description
⌘ + zoom in
⌘ - zoom out
⌘ = zoom 100%

The plugin zooms the control without FileMaker knowning about, so the title bar doesn't zoom with it, but we expect you know what the column headers are anyway.

Hide fields

While the list has focus, you can press ⌘ βŒ₯ F combination to toggle whether fields show up.

The plugin hides all lines containing :: in the list. Or do we? If you watch closely, you may notice our trick. We don't hide them, but change the height to 1 in order to not mess up the list for FileMaker.

Hide global variables

Similar to hiding fields the list has focus, you can press ⌘ βŒ₯ G combination to toggle whether global variables show up.

Again we change line height to 1 to hide them from view.

Tooltips to show values

For the debugger we once created a feature to show the value of a variable or field in a tooltip. So while hoving over a variable name or Table::Field notation, the plugin can evaluate that and show you the value.

The data viewer already shows you the value, so the feature is not so useful in the data viewer. So please use it in the debugger, so you don't need to look into the data viewer to see the value of a value.

DataViewer Content

The FM.DataViewerContent function allows you to query the content of the data viewer as text. This was created to either use it for automatically logging in debugging sessions to what you see in the data viewer. The calculation triggering the MBS function may be triggered via hotkey (see HotKey.Register), in a monitored expression or maybe even in a script. For the script, a short pause may help to refresh the window.

Of course we can only capture visible text, so you can disable this function with not having sufficient permissions to see variables or by hiding the window.

Debugger.IsDataViewerVisible

If you like to know whether the data viewer is visible, just call Debugger.IsDataViewerVisible function. this may be used to detect in a script or function, whether it is being debugged an doing extra work, like setting debug only variables. (see also Debugger.IsVisible).

Copy Content

When the list has focus, you can press ⌘ βŒ₯ C to copy the content. This wil copy the content of the data viewer and paste it e.g. in some text document.

While all those improvements should be built-in to FileMaker and available for both macOS and Windows, we know Claris has a bit different strategy. So for the time being, we add those if you install the MBS FileMaker Plugin on macOS in either FileMaker Pro or Claris Pro.

Please do not hesitate to contact us with questions.

3 Likes

Thanks Christian @MonkeybreadSoftware great stuff. The debugger showing in tooltips what is involved in the script step. I wish it would be possible to show it on each line of execution without hovering. Running the debugger and searching for the values in the data viewer is such a hassle.

@MonkeybreadSoftware, Christian, is there a MBS function to export and import the content of the data viewer?

I have a script that crashes FM constantly on my machine with 20 (not the one with 19) and I need all my watch expressions (they are not causing the crash) to debug the darn thing. Problem is that i loose my watch list each time it crashes so I am wasting so much time setting them it is insane! I wish I could just save them somewhere and reload them with a button!

btw it was a request on Claris ages ago I wish people would vote it up lol

1 Like

Sorry, I can’t add values programmatically.

You could use our trace function to log plugin calls.

And write with Trace.WriteLine you add your own log messages.

I hope you can log something happening just before the crash. You can even include that trace write call in the data viewer.

And you can upload a crash log to check.

1 Like

Thanks for your reply. It's unfortunate cuz I'm pretty sure you would have given us that goodie long ago! Thanks for your hard work!

Got the log crash so I was able to see that it happens because of some issue with a print restore (no printer installed on the machine). Disabling that step I can work on other stuff.

Data Viewer and Debugger haven't been improved by Claris in over 20 years!

From what I've heard, the reason that Claris are resetting the data viewer watch list is precisely because the watch expressions have the potential to cause problems.

Ideally it should give you the option to restore it ...

2 Likes

If you are in a situation where you think there is a chance that FMP will crash and you need to have the data viewer open, I suggest making a copy of the FMP "plist" preferences file ahead of time. This file has your Watch expressions in it.

On a Mac, the file is located at:

/Users/YourUsername/Library/Preferences/com.filemaker.client.pro12.plist

If FMP crashes and you lose your Watch Expressions stuff, quit FMP (if you restarted it to check the data viewer), delete the existing plist file and replace with the backup copy. Restart FMP and all your Data Viewer items should be back.

Because I have been burned a few too many times, I go a little bit further and use the Hazel app on my Mac to periodically make a copy of this plist file. It takes the copy and compresses it into a zip file, renames it with the current date and time, and moves it to another folder for backup purposes.

2 Likes

:warning:

The plist file contains a lot more than just your watch list.

At present my plist file is 8079 lines. My watch list occupies 18 lines in the plist. The other 8061 lines contain information about the state of my application. The favorites list, hosted files and other dynamic menu information that impact the behaviour of FileMaker.

One interesting feature is that FileMaker reads the watch list from the plist on opening. While FileMaker is active, the plist does not contain the watch list. FileMaker stores the watch list in the plist while closing. This makes sense of the fact that it is lost is a crash. FileMaker isn't able to write the watch list back into the plist, so it is lost.

2 Likes