Sorting Scripts by Name in FileMaker with MBS Plugin

On every travel you learn something new. At a FileMaker developer meeting in Montreal, we discussed about what people miss in FileMaker and a plugin could add. And the wish several people mentioned is to sort scripts in the Script Workspace.

We got several challenges here to solve. First this is not like on the script, where we can just add a custom contextual menu. There is already a FileMaker contextual menu, so we have to intercept the menu and our own entries, which seems to work fine so far. Since the implementation depends on the things we made to show Script IDs, the two features are linked currently.

The next one is to actually do the sort operation. There is not much to leverage except that you can manually reorder them with the mouse. Our plugin can do that by telling you started a drag at one spot and then release it to another spot. You may see the entries moving as far as animations are happening.

Please try it out soon in 12.2pr1 in early April.

5 Likes

phantastic!! Every object-list should have that function (layouts and more...) - just to find out what came in recently. If several developers are on one solution/project...

I think that's mac-only )-:

2 Likes

We also have this in the plug-in for fields and layouts.

2 Likes

can we sort by date (creation, modyfied)?

We currently only sort by name.

I could sort by some other field in the list, but I don't see dates there.

It would be interesting to be able to sort by ID. It's not a date but it would allow to identify when it was created.

Isn’t that the same as unsort?

No. You are able to change the order manually by drag and drop.

1 Like

yes it is the same but there is no unsort for scripts name. You must do it manually

1 Like

The interest of sorting the scripts by date/ID is to be able to find a script that you created a short time ago. The paradise would be to have a sorting by modification date. As Christian got us used to miracles... I put the subject back on the agenda

To sort by Date Modified, that metadata would need to need to be available somewhere. I don't believe that FileMaker stores "script's most recent modification timestamp" anywhere that could be accessed by a plugin. It is not available in the XML if you save a copy of a database as XML, and it is not in the XML copied to the clipboard when you copy a script. Christian's previous responses on this thread indicate he doesn't see that piece of metadata available to the plugin, either.
So, there is apparently no way to automatically make a "most recent modification timestamp" available per script.
However, if MBS users think it is worth it, someone (Christian?) could propose some kind of standard comment script step at/near the beginning of each script, where a developer has to manually update a "Modified Timestamp" in some way. My own development standards usually involve at least updating a "History" comment near the beginning of a script, with an ISO8601 date slug, developer name, and what was changed. Someone could make a side utility (or perhaps an MBS feature?) that makes it easy to add a "modification" entry to the standardized-format comment script step.
This would be a LOT of work, and would rely on developers being meticulous about logging their changes. So, I'm assuming Christian wouldn't want to devote time to adding this unless there was a critical mass of folks interested.

1 Like

@DanShockley At least if you could sort by ID, you would have creation order - not modification order - a tiny step in the right direction on software configuration management's source code control process that FM is sorely devoid of today.

1 Like

Hey, I did implement sort by ID. Have you tried it?

Press option and shift keys while the menu is open.

It shows in the context menu, but is greyed out.....13.4.0.08

Strange. Shows and works here.
I had to reenable script IDs and then should be enabled if selection count > 1.

The missing piece of the equation is to select a range of scripts first, THEN do the context menu. I assumed (wrongly, apparently) that it would sort like any dialog - everything in the list.