6 Replies Latest reply on Apr 29, 2013 1:16 PM by JimMac

    Extend Found Set and Maintain Record Position

    mperley

      Title

      Extend Found Set and Maintain Record Position

      Post

           My solution has a "Salesperson" privilege set that ensures a user can only see his/her own records. It also has a script that grabs the primary key of the record selected in a portal and performs a find on that primary key in a different layout (a GTRR script step did not work in this case).

           As it should, this script contrains the found set to the selected record. However, the behavior I'm trying to achieve is simply go to the selected record in the found set that contains all records created by that user. For users with access to all records regardless of creator, I accomplished this by performing a "Show All Records" as the last script step. However, doing this for the "Salesperson" privilege set shows a lot of <No Access> records (which I'm trying to avoid).

           I've tried to re-set the found set by performing a find and extending the found set such as _pk_contactID=*. This prevents all of the <No Access> records from showing, but it fails to show the record previoulsy selected from the portal (I think it is going to the first record in the found set). Is there a way to overcome this?

        • 1. Re: Extend Found Set and Maintain Record Position
          JimMac

               I may be misunderstanding your problem but it sounds like you are trying to "bypass" FMP security, which I have found is very well done in FMP.

               

          However, doing this for the "Salesperson" privilege set shows a lot of <No Access> records (which I'm trying to avoid).

          You need to rethink  your Salesperson securiity locks, or i dont  understand your problem.

          Jim...

          • 2. Re: Extend Found Set and Maintain Record Position
            mperley

                 Hi Jim, I must have done a poor job of explaining myself. I'm not trying to bypass FMP security to show the detail in those <no access> records, rather I'm trying to adjust the found set such that those <no access> records are exlcuded. Performing a find such as _pk_contactID=* successfully does this, but doing so changes the focus from the record selected from my previous find to the first record in the found set. For reference, this is the script I'm running:

            Set Variable [ $ConID; Value:Contact Search::_pk_contact_id ]
            Close Window [ Current Window ]
            Go to Layout [ “Contacts” (Contact) ]
            Enter Find Mode [ ]
            Set Field [ Contact::_pk_contact_id; $ConID ]
            Perform Find [ ]
            Extend Found Set [ Specified Find Requests: Find Records; Criteria: Contact::_pk_contact_id: “=*” ] [ Restore ]
            • 3. Re: Extend Found Set and Maintain Record Position
              JimMac

                   I think I understand.  You want to find, for the "Salesperson", all of his availble contacts and avoid a found set that includes <no access>.

                   If so... 

                   Change your Find Criteria to include the field that identifies your Salesperson first.  then let that Salesperson select form  his own private list, there is no need to extend.  The <no access> should be avoided if your Security "lock" field works.

                   If you must find the _pk_contact_id first, then also add [Set Field] the Salesperson ID before the Perform Find, thus making a AND type search.

                   Jim...

              • 4. Re: Extend Found Set and Maintain Record Position
                mperley

                     Thanks Jim. Unfortunately doing so still restricts the found set to the contact record selected in my search layout. I was hoping to simply go to that contact record in the found set of all contacts for that user. This may not be possible, though, and I should stick to a more traditional search and "show all records" button that the user can go back and forth between. I was hoping to avoid having to explain what found sets are to each user as he/she is added.

                • 5. Re: Extend Found Set and Maintain Record Position
                  philmodjunk

                       What field in contacts determines that these records will be accessible for a given user?

                       Seems like you should use that field via a relationship so that GTRR will work for you in a significantly simpler script.

                       Using your current script. If you stored the PK in a variable, your script could loop through the records after the Extend Found set, exiting the loop when the current record's PK matches the value in the variable.

                  • 6. Re: Extend Found Set and Maintain Record Position
                    JimMac

                         I must be me, because it should be easy to do this....

                         

                     However, the behavior I'm trying to achieve is simply go to the selected record in the found set that contains all records created by that user.

                          

                    Don' use your script as you show, but go directly to the Contacts made by the USER.  Phil points outs the GTRR way with a relationship and ask you what field determines the USER who created the record.

                    A simple find by that USER identifier field... lets call it SalesPersonID and his/her Privilege Set for purpose of discussion.  On a layout using the contacts table info, doing a Find on SalesPersonID  will find all of his records.

                    Then the User can select the right record from his list of contacts.wink.  It is not what your script does, but his new select will set the PK for you.

                    If you do Phil's new relationship using SalesPersonID Then no Find is needed since the found set will be exclusively his/hers.

                    Note: We are pointing you in another direction to do what you want!!cool

                    Jim...