Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 7959 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Saving a search query.

I would like to keep a log of what poeple have searched for is that possible?

Posted

Not exactly straightforward is right. Here is a script that I wrote a while back to find the criteria of the most recent find operation. Some of the complexity of the script is due to the formatting that it does. It requires Applescript to get the correct omit/find choice of each request, So, it won't be completely accurate if you run it on a PC.


# GetFindCriteria

# "This script retrieves the find criteria used in the last successful find operation."

# "The criteria are placed in the global text field "gSearchField""

# ""

# "To customize this to your application, do the following:"

# "1. Create the global fields that are used as the results in the Set Field steps below."

# "2. Change the indicated step below, as described. (marked with '*****')"

# ""

# ""

# ""

# "The only way to determine whether the find requests have the omit box checked is to use Applescript."

# "So, that info can not be determined on Non-Macintosh platforms."

If [ Abs(Status(CurrentPlatform))=1 ]

Perform AppleScript [ Script Attachability: Script Text:

"tell front window of app "Filemaker Pro"

set AllOmitStatus to ""

repeat with ThisReq from 1 to (count requests)

set IsOmitted to omitted of request ThisReq

if IsOmitted

set AllOmitStatus to AllOmitStatus & "1"

else

set AllOmitStatus to AllOmitStatus & "0"

end if

end repeat

set cell "gOmitted" of current record to AllOmitStatus

end tell" ]

Else

Set Field [ gOmitted , "00000000000000000000000000000000" ]

End If

# " ***** Change the following step as necesary to use a layout that contains all searchable fields."

Go to Layout [ AllFields ]

Modify Last Find

# "If there were no valid find requests, mode will not change to find."

If [ Status(CurrentMode) != 1 ]

Set Field [ gSearchField , "No valid search criteria" ]

Go to Layout [ original layout ]

Exit Script

End If

Set Field [ gFieldCount , 0 ]

# "Count the number of non-global fields"

# "Pick any field to start on."

Go to Next Field

Set Field [ gSearchField , Status(CurrentFieldName) ]

Loop

If [ LeftWords(FieldType(Status(CurrentFileName), Status(CurrentFieldName)), 1) != "Global" ]

Set Field [ gFieldCount , gFieldCount + 1 ]

End If

Go to Next Field

# "Done when the current field is the same as the start field."

Exit Loop If [ gSearchField = Status(CurrentFieldName) ]

End Loop

Enter Browse Mode

Set Field [ gSearchField , "" ]

Copy [ gSearchField ]

[ Select entire contents ]

Modify Last Find

Go to Record/Request/Page

[ Last ]

# "Loop for each find request."

# "Concatenate all find criteria in each request. Insert a

This topic is 7959 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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