Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Trouble with simple Find and Sort Script

Featured Replies

I have created an elaborate field export script that seems to work fine. It seemed a monumental task compared to this I now can't seem to figure out...

I run into trouble trying to prepare the content for export - my steps are:

Modify Last Find - this works and finds the records based on the field I want - which happens to be the first in the layout.

I then want to sort the found records by my Date field in ascending order and when sort is done, go to the First record.

Sadly, FM fails to perform the Sort at all. No Idea why. Sorting works manually and as a separate script - saving the criteria and choosing "perform without dialog" circumvents the dialog...

But I now have 3 scripts instead of just one - one to find, one to sort and go to first record and the last to export the found and sorted... Ideally, I want my script to ask which section I want to export (my find criteria - a single field), allow me to choose the find parameter in that field and then execute the rest without any interaction from me.

Help greatly appreciated... it feels like the solution must be really simple.

Thanks

Manca

This is very basic but should do what you want. I can elaborate if you like.

Go to Layout["layout name"]

Enter Find Mode[pause]

//Allow the user to enter find criteria, pressing return or enter will continue the script.

Perform Find

if [ Get ( LastError ) = 0 ]

Sort

Export

end if

Since you are on a Mac, print your script to Preview, and copy and paste it into a Reply, so we can see it.

It's odd that your sort isn't working, are your sure that it is really a Date and not a text field (if it is a calculation, then be sure that you have this as a type Date).

I'm not sure why you have to do a modify last find, but maybe that will become clear when we see the script.

HTH

Lee

  • Author

This is what I have:

Modify Last Find

Sort Records [ Specified Sort Order: Bob Howard Content::RecordDate; ascending ]

[ Restore; No dialog ]

Go to Record/Request/Page

[ First ]

I verified the RecordDate field is indeed of type Date.

Thanks

Manca

  • Author

OK, you suggestion worked. Still not sure why my script stops... I am now able to do it all on one script, thanks!

The only thing I modified from yours was - I added a

Go to Record/Request/Page [ First ] command so the Export happens from page 1 in found set.

On a semi-related note - do either of you know if FM Pro is capable of creating folders at the export destination? It would be easier if I could have it create any specified folders in the file path - now if they don't exist, the script fails. So currently, if I want to be certain I am working with the latest version of the export, I have to replace my folder structure with an empty one and then re-export. If I could just erase and have Fm replace missing folders, that would be neat... You know, the way a Unix command creates the destination if none such exists and replaces it if it does.

Manca

Edited by Guest

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.