5 Replies Latest reply on Jun 16, 2015 9:09 AM by philmodjunk

    Agent collision on data import question

    Stu412

      Title

      Agent collision on data import question

      Post

      I'm preparing an import routine which is pretty central to the DB solution I've built.  It'll be used many times by many people in a FM Server/Client environment.

      The basis is that a user imports data to what's basically a temporary table, whereupon they can review the data prior to a full import to the main data table.

      A script fires when the user hits 'Go' and performs the import to the main data table.  The final act of the 'Go' script is to delete all records on the temp table, leaving it clear for the next import.

      I need to ensure that there can be only one set of data on the temp table at any one time and that this is being used by only the user who placed it there until the 'Go' script has run its course.

      I have no idea how I might do this and I hope I've made the scenario clear!

      Thanks in advance

        • 1. Re: Agent collision on data import question
          philmodjunk

          Let multiple users all import data into that table at the same time. It won't be a problem if you take a few precautions.

          Set up a field in the table that "marks" them as being for a particular user. This might be a field that auto-enters the creation account name if you enable auto-enter options. Or you can use replace field contents immediately after the import to mark the records just imported for the given user.

          Then, instead of delete all records. Perform a find for all records so "marked" as belonging to the current user and use Delete All Records (Which really deletes only those records in the current found set), to delete just the records imported by the current user.

          • 2. Re: Agent collision on data import question
            Stu412

            Phil

            Thanks for this.

            So to confirm, setting a 'tag' field as auto-enter Get(AccountName) will allow me to identify which records belong to which user.

             As a next step, include Get(AccountName) in the find routine I already have and this will show only the current user's records (in the instance other users have records on the table).

            To conclude, I'll import from here (this table is a step stone) - the found set per user will be the only records imported, and then delete this same found set on confirmation.

             

            • 3. Re: Agent collision on data import question
              philmodjunk

              There are some details to watch out for:

              1) You have to be using an import records step that specifies that auto-enter options are enabled. This is not always what you want if other auto-enter options produce undesirable results for your imported data.

              2) stored find requests can't evaluate a calculation expression like get (accountName) so either assign this value to a variable and use the variable in the stored request, or (better) use the enter find mode/set field/perform find  method for specifying your find criteria.

              For examples of using set field in a scripted find: Scripted Find Examples

              • 4. Re: Agent collision on data import question
                Stu412

                I think your point in 2) is where the issue for me is occurring.

                Let's say data exists already on the shared import table, put there by USER1.

                USER2 comes along and imports their data, but immediately they see the data from USER1 despite me having a find request which searches only for that particular user's data.

                Enter Find Mode[]

                New Record/Request

                Set Field[ImportTable::ImportedBy ; Get(AccountName)]

                Perform Find []

                The theory is that this will only return data which the USER2 has entered and therefore they won't see USER1's.  

                Am I to understand that Get(AccountName) won't work in the above scenario and therefore it's best I assign this to a variable?

                Thanks

                 

                • 5. Re: Agent collision on data import question
                  philmodjunk

                  I think you need to read my last post again. It WILL work when using Set field. It won't work if you try to enter Get (accountName) as stored find criteria.

                  Each Import records action produces a found set of the imported records so it should be pretty easy to keep the records imported by another user from being viewed by the user. You can even set up a record lock expression in manage security that keeps all records that do not have the current user's account name from being accessible.