4 Replies Latest reply on Apr 10, 2013 5:09 PM by debi

    Error selecting field in portal

    mcrostie

      Hi

       

      My solution has a Person Table in list view and within each record has a portal of related images for each person. Some images are marked as "yes" and some "no" and some empty if there are no images relating to that person.

       

      I have just added a Script Trigger "on record load" with the parameter's - Let( $$ActiveRecordID = Get ( RecordID ) ; "" )

       

      This then does a conditional format - $$ActiveRecordID = Get ( RecordID ) - to highlight the current record "on record load"

       

      Now the following which used to work, has some glitch

       

      I have a button attached to the "Yes", "No" and "Empty" in each portal row (with a script attached), which then selects that particular record within that portal to add to another TO.

       

      The first part of the script asks if a field has the status "yes", "no" or is empty

       

      Now for some reason (my question) this is not happening corectly.

       

      Any ideas?

       

       

      Regards

       

      Michael

       

      Message was edited by: mcrostie Hi Again Attached is a screen shoot of my Person Table in List View. The green and red, (Yes and No) buttons start my order script and by selecting the corresponding buttons determines the image that is to be ordered. Without the on record load trigger script, my script does what is required by first finding the state of the button "Yes", "No" or "Empty" with an "if" statement. However, by adding the On Record Load Script, I cannot seem to work out why it is not selecting the portal line I have selected. Hope this is a little more better explained Thanks Michael

       

      Message was edited by: mcrostie  Thanks to all that answered, I have found my error and have decided I require more study....... Even though I have selected the record (via the portal) and the On Record Load script - works - I am getting the Yes /No from the first related record in the record and not the portal that has triggered the On record load......Thanks all

        • 1. Re: Error selecting field in portal
          IT_User

          Hello,

           

          Instead of using the Let function you can use:

           

          Set Variable [ $$ActiveRecordID ; Value:Get ( RecordID ) ]

           

          Unless you are trying to do other things in the calculation.

           

           

          Now the following which used to work, has some glitch

          I have a button attached to the "Yes", "No" and "Empty" in each portal row (with a script attached), which then selects that particular record within that portal to add to another TO.

           

          The first part of the script asks if a field has the status "yes", "no" or is empty

           

          Now for some reason (my question) this is not happening corectly.

          What is happening instead if it isn't happening correctly?

          • 2. Re: Error selecting field in portal
            LyndsayHowarth

            Hi Michael

            I have just added a Script Trigger "on record load" with the parameter's - Let( $$ActiveRecordID = Get ( RecordID ) ; "" )

             

            This then does a conditional format   - $$ActiveRecordID = Get ( RecordID ) -  to highlight the current record "on record load"

             

             

            I really don't understand how this "Let( $$ActiveRecordID = Get ( RecordID ) ; "" )" would do anything apart from give you an empty value.

            As IT_User pointed out, you need to define what $$ActiveRecordID is as a variable before you can do anything with it.

             

            When you say "Used to work" are you implying that you have changed versions of FMP.... because there were a few changes to some of the functions between (approx) versions 9 and 11 which would impact on what is considered an "active record".

             

            Your active record is the current record. If you add it to a variable like $$ActiveRecordID you can then go and act upon it elsewhere. The portal record that is active is not the active record... the parent is.

             

            I am a bit bewildered as to what you are actually trying to achieve. Do you want to highlight in a portal the row which is currently selected? or is it something more involved than that?

             

            - Lyndsay

            • 3. Re: Error selecting field in portal
              mcrostie

              Hi Lyndsay

               

              This is what i was trying to implement in my solution

               

              https://fmdev.filemaker.com/thread/51340

               

              Hope this make more sence as well as my update above

               

              Regards

               

              Michael

              • 4. Re: Error selecting field in portal
                debi

                Michael,

                 

                 

                First of all, your Let statement may appear odd because, typically, we set a bunch of values in the first part of the function, and then use them within a formula to return the final value to the field/script/whatever where the Let calc resides. The way you are using it here, you are returning "" (essentially: nothing). HOWEVER, by setting $$ActiveRecord, you are simultaneously creating a $$ global variable that persists - and is used in the record's conditional formatting. I've done this myself, though SetVariable [ $$ActiveRecord; Get (RecordID) ] should yield the same result.

                 

                The problem you are experiencing is with the rest of the script, specifically the Commit Record step. Committing a record loses any portal row focus you may have had. Try omitting that; it should still work. Otherwise, you will need to capture the portal row number and navigate back to that after committing.

                 

                Debi Rubel

                FullCity Consulting