4 Replies Latest reply on Feb 8, 2015 1:58 PM by disabled_jackrodgers

    Counting 'flagged' records

    chrishadden

      I am stuck with what should be a very simple task. In a database, I want the user to be able to "flag" certain records, but to pop up a custom dialog to warn if a certain number of "flagged" records is exceeded. My approach has been to have the "flag" field as a Yes No radio button, and to attach an OnObjectModify script to pop the custom dialog. My problem is to create an If ... ElseIf in the script that will trigger the custom dialog if the predetermined number is exceeded. I wondered about using an internal join, but not quite sure how. Any suggestions would be most welcome! I am using FM Pro 12.

       

      Chris

        • 1. Re: Counting 'flagged' records
          keywords

          See attached demo file.

          • 2. Re: Counting 'flagged' records
            chrishadden

            That works like a dream - many thanks for such a quick response

             

            Chris

            • 3. Re: Counting 'flagged' records
              Garryt

              If you need to use a multi-user solution, you will need to consider that once a record is flagged as part of a selection, you may want that selection to be unique to the user.

               

              For this scenario, you will need to cretae a related table, which stores a reference to each record that a user selects. So when you click a button, that recordID will be set in a related record along with the user ID and something unique to indicate when the selected set refers to.

               

              The chosen record can show in a portal, where you can give the user the ability to delete it if wrongly selected. A global field can be used in the relationship to ensure only the active users records are displayed.

               

              Also, you can use a global field to calculate the amount of records that have been selected, so each user will have their own record count.

              • 4. Re: Counting 'flagged' records

                It would be simpler to make the flag field text formatted as a checkbox and make the link field a global with the text. Then you don't need any calculations.

                 

                Flag Field text is empty or "Flag"

                List value = "Flag"

                Field is formatted as a checkbox with the list assigned to it

                 

                The calcualated linking field value is "Flag"

                 

                The checking of the box toggles between flag and empty.

                 

                One can be used by you have to adjust the text on the checkbox so it doesn't show.

                 

                For multi-users add a global calulated field that uses get(accountname). Create a new in between table with two fields: account name and record id.

                 

                Link this new table to your current table with a double link: the account name to the global account name and the record id to the record id.

                 

                Drag your portal as shown elsewhere.

                 

                Your LINK button with

                 

                Set variable $_record_id the current record id

                freeze window

                go to layout In between file

                New record

                set field record id $_record_id

                set field account name to get(accountname)

                commit record

                go to layout original layout

                refresh window

                 

                Each account now has its own set of records in this new table. You can count them before creating the new record, etc.

                 

                You could use just one link for the record id and filter the portal however...