7 Replies Latest reply on Jul 12, 2012 3:06 PM by philmodjunk

    Set Field by Name in search mode – issue with some search operator characters (less-than, greater t...



      Set Field by Name in search mode – issue with some search operator characters (less-than, greater than)


      FileMaker Pro


      tested in FMPA 11.0.4 + FM 12.0.1 (both the same problem)

      Operating system version

      Mac OS X 10.6.8

      Description of the issue

      Bug or feature? I'm not sure. But a strange and irritating behaviour, IMHO.

      The command:
      Set Field by Name [; "<"] does not work in search mode.

      Nothing is inserted in the target field. With other search operators, it DOES work, e.g. "=", "?"; "@", ... And in browse mode, it also works. It only works, if the operator is followed by text or numbers, e.g. "<1".

      Operators/characters affected:
      <, ≤, >, ≥

      First I thought this would help, but it doesn't:
      Set Field by Name [; GetAsText("<")]

      I am trying to build a search layout without the status area, but with a self-built possibility to insert search operators from a dropdown list and some trigger scripts (I know, it's also possible to insert operators in a search field with right-mouse-button, but not every user knows it ...). And I have to fight with this problem ... it should also be possible to insert "<" in an empty field to let the user type his search text or numbers behind it.

        • 1. Re: Set Field by Name in search mode – issue with some search operator characters (less-than, greater t...

          Patrick Horn:

          Thank you for your post.

          I am able to replicate the issue on both Mac OS X 10.7.3 and Windows XP (SP3).  I have sent your post along with my findings to our Development and Testing departments for review.  I will contact you when I receive feedback.

          In the mean time, use the script step:

          Insert Text [ <target field> ; "<" ]

          FileMaker, Inc.

          • 2. Re: Set Field by Name in search mode – issue with some search operator characters (less-than, greater t...


            Thanks for your fast reply and the hint.

            I also used a method with Go To Field (in a loop with GoToNextField to find the target field) and then:

            Insert Calculated Result (<no field in the command; use active field>;"<")

            That works also. But it only works if the target field is in the tab order! (Which they usually are in a search layout, but exceptions always happen ...) And there is no command "Go To Field" with the possibility to specify a calculated target field as far as I know (I am missing this – perhaps a worthy suggestion!).

            So the soluation with "Set Field by Name" would be the best choice – much more elegant, faster (without looping) und without the problem of fields not in the tab order. If there wouldn't be this problem.


            My workaround for the operators <, ≤, >, ≥ is now to use (e.g. with "<"):

            Set Field by Name [<target field>; "< [value]"] – so the user has to delete "[value]", but gets his operator in the field ...


            Best regards,


            • 3. Re: Set Field by Name in search mode – issue with some search operator characters (less-than, greater t...

              Patrick Horn:

              Thank you for the additional information.

              However, after you use the "Set Field by Name" script step, the cursor will still be in that particular field.  Follow this script step with:

              Insert Text [ Select entire contents ; "<" ]

              That is, do not specify a field name.  This step will take whatever is in the current field ("<1" ?) and replace it with "<", and your cursor will remain in the field in Find mode.  This should be easier than looping through the fields and comparing.

              Let me know if I'm not on the right track.

              FileMaker, Inc.

              • 4. Re: Set Field by Name in search mode – issue with some search operator characters (less-than, greater t...


                This is a nice idea. I didn't try this. I made some tests and found out some strange things with "Set Field by Name" (both new for me):

                1.) The cursor will NOT remain in the field after "Set Field by Name" in Search Mode or Browse Mode (except the cursor was in the field before, but it can not be there in my script; see explanation of my construction below). I tested it in FMPA 11.04 and 12.0.1 (Mac OS X 10.6.8) with a one-line-script. If it would remain in the field, it would be a solution for the missing command "Go To Field" with calculated field name ... Too bad ...

                That's also new for me and puts a large question mark to the use of "Set Field By Name", because inserting the search operator is only 50% of the way, the other 50% is to put the cursor in the field ...

                Perhaps the only (complete) solution in the moment is a loop with "Go To Next Field" and to take care that every field in the layout is in the tab order ...

                2.) If there is a field from another table in the search layout (this often happens in my case), and the cursor is inside that field (no matter if it's empty or already some characters in it), the command "Set Field By Name" does not work with that other-table-field (I don't speak of the problematic characters "<>≤≥", but every normal text)! Nothing is inserted, existing text is not replaced. With fields of the same table as the layout, it always works. And it also works if the cursor is in ANOTHER field of another table.
                In browse mode, it's no problem (if there is a working relation between both tables, and records of both tables exist).


                It doesn't help in my case. I try to explain in short terms my construction, although I'm not good in making short excerpts:

                – I try to "simulate" the drop-down list "Insert operators" of the status toolbar in search mode when the status toolbar is hidden.
                – My search layout is set to list mode (to create several search requests each under the other).
                – The layout has a header area with a field used for the drop down list (it must be a "real" field, not a global field; I use a field of a preference table which only has one record, and I empty this field before the search is starting – as a precaution in a loop for every request, not sure if it's necessary). Of course, it's control style is "Pop-up menu" with a value list containing the same entries like the drop-down list in the status toolbar, e.g. "= match whole word (or match empty)".

                The functionality needs some trigger scripts, basically these two scripts:
                – Every field in the search layout has a trigger OnObjectEnter => calls a script which saves the complete name of the field in a global variable (<table name>::<field name>), let's call it "$$memorize_field".
                – The field with the pop-up menu: OnObjectSave => calls the main script that should insert the selected search operator (which is extracted from the value list text) into the last field which was entered before (whose name is saved in $$memorize_field).
                – So in the moment when the search operator is selected via the pop-up menu field in the header, the cursor is no longer in the search field
                – That's the difficulty.

                Beside these two main trigger script I need some other scipts and trigger scripts, e.g.:
                – "OnRecordCommit" => empty "$$memorize_field" (cursor is in no field)
                – "OnObjectEnter" => empty "$$memorize_field" if the selected field's control style is "checkbox set" or "radio button set", where search operators should not be entered, because the user normally can't see the operator or enter text behind it – I made this as an improvement compared to the standard filemaker behavior.

                But the main script is the one with "OnObjectSave" and the operator chooser field ... there the problem comes from –> to go back into the last field and doing this:
                1.) enter the search operator in the target field (if field is not empty, I place it at the beginning, keeping the content, or at end in the case of the "..." operator)
                2.) put the cursor (back) in the field to allow the user to type

                And I really don't want to resolve point 2 by a long script step list like:
                if ($$memorize_field = "X")
                    GoToField (X)
                else if ($$memorize_field = "Y")
                    GoToField (Y)
                else if ($$memorize_field = "Z")
                    GoToField (Z)

                Because I want to have a universal script which works with all of my search layouts and no matter if I add a field there or remove one ... and I want to be able to rename my fields and tables if necessary ...

                If there is a better solution to simulate the filemaker drop-down list "Insert operators", please let me know. This is the way I found ...

                As a suggestion: filemaker developers could always think about if it's possible to "build" the elements of the status toolbar of browse and find mode with the scripting and layout possibilities of filemaker in the case you don't want to show the status toolbar in your solutions  for design reasons. It's easy for the browse buttons, but can become very tricky (or impossible?) with other elements. Even "simple" things like "Matching Records: Include/Omit" are hard to simulate if it should work with more than one request (like it works with the filemaker status toolbar) – I managed to script this with a checkbox field, but it was hard and cost me some hours of scripting ...

                Or even this suggestion (or in addition):
                it would be nice if every element of the Filemaker status toolbar would exist as a layout element which you simple could drag into your layouts; of course with the complete automatic functionality of the element (if this doen't destroys your screen design, it would be a fast solution ...).

                Best regards,

                • 5. Re: Set Field by Name in search mode – issue with some search operator characters (less-than, greater t...

                  Patrick Horn:

                  You are right.  I was referencing the first field, so it defaulted there.  My apologies.

                  I can't think of another way off the top of my head.  You may want to post to "Using FileMaker Pro" board, as a lot of developers are there who may have encountered this scenario and found a viable workaround.  Or, there may be a developer who likes challenges.  :-)

                  In any case, the information has been reported to Development and Testing (no reply yet).

                  FileMaker, Inc.

                  • 6. Re: Set Field by Name in search mode – issue with some search operator characters (less-than, greater t...

                    Hello TSGal,

                    OK, thanks for the confirmation.

                    I understand that you cannot engage deeper in this quite special problem. For the moment I will keep my looping ... it works at least (if everything is in the tab order).

                    And I will take a look in other boards or other forums/blogs if somebody did fight already with the same thing and found a better solution ...

                    And perhaps there will be some reply of the Developement and Testing departement and my suggestions are welcome – would be nice.


                    Have a nice day,