6 Replies Latest reply on Jan 18, 2016 9:57 AM by thurmes

    Radio Buttons

    yiningw

      How exactly do you get radio buttons to work? Say I have a list of records with one of the fields saying "A" or "B". How do you create a button that performs find according to whether that field says include A or B?

      Also, is there a way to perform a hierarchy of finds from these radio buttons? I.e. after choosing field A, within that find I also want to find from another field the A's from today / yesterday / last week.

       

      Right now I'm using one separate radio for each option (one button for field A/B, A, another button for field A/B, B). This kind of works but once I want to start finding A's from today it won't save the search. (it shows all records from today / yesterday / last week, rather than the A records from today)

        • 1. Re: Radio Buttons
          thurmes

          Radio buttons are just fields that have a set of possible choices, only one of which can be chosen at a time. They don't inherently 'do' anything. So, if your value list contains A and B, they can be set to either A or B (or, before you've chosen, nothing at all). There's no fundamental difference between setting a field to A via a radio button or by typing A into the field.

           

          If you want something to happen as a result of making a choice, you need to set up a script that is triggered by your making that choice. For instance, set up an OnObjectSave trigger that will perform a find based on that choice; you would typically include that choice as a ScriptParameter, or perhaps you would set up the script so that it will work with many fields, and include the field name as a ScriptParameter (having the script then read the field's contents and act accordingly). Concerning your question about how to do different things depending on your choice of A or B, use If statements in your script (if that was already obvious, sorry for mentioning it).

           

          I'm not sure how you plan to keep track of when A was chosen; it might be by setting up a field that autoenters the modification date, and then dog a find using both A and the date as parameters. Obviously finding A is trivial; setting a date range is reasonably easy, using Get ( CurrentDate ) and the various date-related functions. If you have a specific question about how to do that, ask and I or someone else on the site can help you with that.

          • 2. Re: Radio Buttons
            Markus Schneider

            radio buttons are normal fields in FileMaker - with an option to enter values more quickly by using a predefined list for possible values. A field with a radio-button does allow one of several predefined values, like the old style buttons on old radios that let You selecet AM or FM - but not both. Although in FileMaker one can assign more than one value by pressing a modifier-key when selecting a value, the principle should remain the same

            - create a filed

            - create a value list

            - assign that value list to the field using the inspecter, choosing between one of the options for representing (menue, list, checkbox, radiobutton,)

             

            you can have the same field several times in a layout, with several valuelist (if it makes sense)

             

            when You are searching, just perform a 'Find' from the menue (or by a scrip) and click on 'A'.. just like 'normal 'Finds'

             

            a radio button does in its core nothing than assigning a value without the need of typing in, without typing mistakes. You can double the field, on time as raiobutton filed, one time as 'normal' field an see what happens when entering values in one of them. in browse mode, in find mode...

             

            if You want actions, use script-trigger (ie)

            • 3. Re: Radio Buttons
              yiningw

              I want the radio button to display the find as "Unscripted" or "Scripted", but the imported records are inputted as only "U" or "S", and there are sometimes more than just the two options (some U's may be accidentally inputted with a space), which is why I was having trouble getting the radio to work after I inputted them as custom values instead of a direct duplicate of the field. That would be a side question to the one at hand though.

               

              Would you mind elaborating on how to formulate the script trigger? I know how the 'if' statement works but I'm not sure how to tailor it to its previous find. What if I wanted an either A or B, then subsequently whether or not A / B was produced by the company? (a yes / no radio button that comes after the A / B radio button). This would kind of be similar to the one i mentioned about the dates but with a different variable.

              • 4. Re: Radio Buttons
                Benjamin Fehr

                As a child, I often pressed 2 buttons at the same time on that old wooden Radiobox in order to get some terrible noise.

                With FMP, you don't need to force it:

                - make your first selection

                - hold [Shift] key to make additional selections

                • 5. Re: Radio Buttons
                  yiningw

                  I did the script trigger option and applied the following script parameter:

                  Case ( PatternCount ( Distribution Status Report::commercial_block; "30" ); "30";

                  PatternCount ( Distribution Status Report::commercial_block; "60"); "60"; "60";

                  PatternCount ( Distribution Status Report::commercial_block; "120"); "120"),

                   

                  with the script being, 1. Set Error Capture 2. Enter Find Mode 3. Perform Find

                   

                  However, it still doesn't show me the records according to each find. Instead, it leaves me at find mode. I know I am doing something wrong but I am not sure how to remedy the situation. What should I write in my script instead so that the script parameter also makes sense?

                   

                  Thanks!

                   

                  efficientbizz mschneider

                  • 6. Re: Radio Buttons
                    thurmes

                    Sorry I haven't responded for a while, I've been too busy to log on much lately.

                    I assume your doubling of the

                    ; "60"

                    was just mistyping? Otherwise it doesn't really make sense (it would interpret the second instance as an equation to solve; 60 should resolve as true; so it would go to the next clause =  PatternCount, and pass the number of '120' in that field).

                     

                    In your Find script, you must specify what you wish to Find. There are three ways to do this, choose any 1 of the 3:

                     

                    1. In the Enter Find Mode script step, you can specify find requests. In this case, you would probably set the field Distribution Status Report::commercial_block to Get ( ScriptParameter ). [Note: another parameter in this step is whether the script should pause here. If you leave it checked, which is the default, the script will not go to the next step; instead, it will stay in find mode. Hint, hint.]

                     

                    2. You can put a step between the Enter and Perform steps, where you use the Set Field step to set the field to your desired find info. Again, you would probably set the field Distribution Status Report::commercial_block to Get ( ScriptParameter ).

                     

                    3. In the Perform Find step, you can specify find requests. Again, you would probably set the field Distribution Status Report::commercial_block to Get ( ScriptParameter ).

                     

                    Note that I don't actually know which field you're planning to set to 30, 60, or 120 in your find step; if I got it wrong adjust the target field accordingly.

                     

                    I hope this helps

                    --Bill