4 Replies Latest reply on Nov 21, 2014 5:22 PM by dzittin

    Determining the active record



      Determining the active record


      I know this has been discussed before, but the answers are not quite relevant to what I am trying to do.

      I have a list of record. I would like a set of radio buttons associated with each record so the user can click on a button and perform one of several actions.

      I do not want the radio buttons to appear on any record in the list _except_ for the current record. Can I determine which record is active and then change the radio buttons from current background to something visible?


        • 1. Re: Determining the active record

          My answer assumes that you are using FileMaker 13.

          Use the OnRecordLoad Trigger to perform this script:

          Set Variable [$$CurrentRecord ; value: Get ( RecordID ) ]
          Refresh Object ["RadioButtonField"]

          Select the radio button field and use the name box in the inspector to give it RadioButtonField as an object name.

          With the field still selected, give it this Hide Object When expression on the data tab:

          $$CurrentRecord ≠ Get ( RecordID )

          • 2. Re: Determining the active record

            As usual, thanks for your timely response PhilModJunk.

            So I guess I am out of luck since I am using FM11pro?

            Nothing I can do in 11?

            If the answer is nothing, then I will popup a window with a button on each record that displays the active record and have the radio buttons on that. It's a little crufty, but beats having multiple radio buttons showing the same selection.

            Thanks again.




            • 3. Re: Determining the active record

              Yes, you can do this in FMP 11, but if you don't tell people that this is the version you are using when your post your question, you risk getting answers not compatible with version 11.

              Hiding objects is much more complex in FMP 11, than the vastly simpler "hide object when" setting in FileMaker 13. And the fact that you are using list view precludes one common trick of using a tab control. The fact that you are using a radio button format rules out using a conditional format expression.

              That leaves setting up a self join relationship matching primary keys with an added "control" match field that is set to a value or cleared to make a record appear or disappear in a one row portal. You can put the radio button formatted field inside the portal row and make the borders of the portal invisible.

              Define this self join relationship:

              YourTable::__pkPrimaryKey = YourTable2::__pkPrimaryKey AND
              YourTable::control = YourTable2::constOne

              Define constOne as a calculation field with the number 1 as it's sole term so that this field always has the value 1.

              Define control as a calculation field with a number result:

              Get (RecordID ) = $$CurrentRecord

              Use the same script performed by OnRecordLoad as posted earlier, but without the Refresh Object Script step. If needed, you may have to put Refresh Window in its place.

              • 4. Re: Determining the active record

                I will be more careful to specify the version. Apologies.