Jump to content

Using partial search in search mode as default?


evance

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

Recommended Posts

  • Newbies

Hi there,

at first I was struggling to find some data which I knew was present and couldn't figure out why...

Data in text field (real example):

  • A 0111
  • B0111
  • B0116
  • TZ0113
  • [...]

Search string (quotes not part of search):

"0111" finds "A 0111" but not "B0111" etc.

But I figured out how to adjust my search so FileMaker will pick up these records accordingly by wrapping it in stars like *TERM* so it performs partial matching:

"*0111*" finds "A 0111" and "B0111"

Now my question is: How can make this the standard search mode / feature without extensively writing scripts for every layout?

I am working with a search layout which includes a lot of fields and I would like to just be able to set "partial search" as default for selected fields or – if that's not possible – for all fields on the search layout, knowing that this can be achieved by using a search script which wraps every input in "*" but that seems kind of over the top.

Thanks for your input!

Link to comment
Share on other sites

Hi evance and welcome to the FM Forums,

IIUC, FileMaker will remember a search performed manually. So perform your search manually and then immediately create the script Perform Find.

Lee

 

Link to comment
Share on other sites

  • Newbies

Hi Lee,

thanks for welcoming me and replying to the question!

11 minutes ago, Lee Smith said:

So perform your search manually and then immediately create the script Perform Find.

Guess this won't be feasible as a server-sided approach, or how do you mean that? I'd need a general solution for all users / devices regardless of which field is being searched in, I thought of a "layout-based" setting...?

It's OK if this cannot be done natively and I have to use some script step(s) to do so but I wanted to inquire first.

Link to comment
Share on other sites

  • Newbies

Just for reference's sake / if anybody else is searching for this:

I've put together a simple script which is being called by a script trigger on my input fields in search mode – I adjust the user input so that FileMaker uses partial search if applicable (single word, string not empty).

Set Variable [ $field_context; Value:Get ( ActiveFieldTableName ) ]
Set Variable [ $field_name; Value:Get ( ActiveFieldName ) ]
Set Variable [ $field_content; Value:Get ( ActiveFieldContents ) ]
Set Variable [ $field_length; Value:Length ( $field_content ) ]
Set Variable [ $field_wordcount; Value:WordCount ( $field_content ) ]
Set Field By Name [ $field_context & "::" & $field_name; If ( $field_length = 0 OR $field_wordcount > 1;
$field_content; "*" & $field_content & "*" ) ]

Regards!

  • Like 1
Link to comment
Share on other sites

This topic is 2310 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.