Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

Using Table.open_session in multi user environment

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Using Table.open_session in multi user environment

    I often use tbl.open_session() in a script for one table when I want to add or change records and the likelyhood exists that it may already be opened by another user like when a form is opened by more than one user.

    I have a new script that opens two tables and the script will interact between them fetching thru one to change or enter records in the other.

    So my question is: If each table is opened in its own session - will my table pointers work the same way as when each is opened in the same session?

    I am also using the FILE_RW_SHARED flag.

    In this script I am updating a one record temp table before printing a report and it is quite likely more than one user may be trying to do the same...
    Last edited by MoGrace; 05-09-2019, 03:16 PM. Reason: more info added
    Robin

    Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

  • #2
    Re: Using Table.open_session in multi user environment

    Hey Robin, sorry that I don't have an answer for your question but I have a question about tbl.open_session().

    I have now been working with Alpha for 9 months now and all the previous developers for my agency have only used tbl.open() for everything. After seeing your post about tbl.open_session() it intrigued me to look into that function but unfortunately the help file does not really go into depth about any advantages or the correct usage of it.

    If you can shed any more details in why you use that function over tbl.open it would be most helpful!

    (Background: We have over 240 users constantly adding/editing/removing data from our tables using our scripts that only use tbl.open() when pointing to a table.)

    Comment


    • #3
      Re: Using Table.open_session in multi user environment

      Hi Andrew,
      The main purpose is as I stated above: If I am using a button on a form or calling a script that will be writing to tables that are likely open/in use, then I use open_session to hopefully avoid conflicts with current data entry. Each time the table is open it gets an alias anyway for the current pointer, but this seemed like it might work better in a multi-user setup.

      So that's my "I don't know either" response!

      From the Wiki: The TABLE.OPEN_SESSION() method allows you to open a table more than once (in a different sessions).
      Robin

      Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

      Comment


      • #4
        Re: Using Table.open_session in multi user environment

        Haha, that did clear it up a little more for me! Thanks!

        Comment


        • #5
          Re: Using Table.open_session in multi user environment

          Robin:

          One way to avoid the kind of conflicts that you mention is to add a "User" field to the temp table. (Assuming your users login and have unique sign-in values.) Then, when User A is adding values to the temp table (I eventually gave up on single record temp tables. Instead I created a full set of table clones for the set and wrote the required records from each table into its clone. A pain to set up and maintain but eliminated all printing problems no matter how many users were active and the main transaction tables were getting huge. But I digress) the record is marked with that user's login. So step 1, query the temp table for that user's records, then delete_range(), then add the new record(s). Then filter the report for that user's records. All using table.open and no user conflicts or concerns about who is doing what to whom. And although it seems cumbesome, it is really fast.
          Finian

          Comment


          • #6
            Re: Using Table.open_session in multi user environment

            Thanks for that idea Finian - I do have a user_id I could use. I will have to consider how to set this up but it sounds workable...

            I take it you read my other thread on creating a temp table for a report?
            Robin

            Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

            Comment


            • #7
              Re: Using Table.open_session in multi user environment

              <I take it you read my other thread on creating a temp table for a report?>
              I did but have been too stuck in some non-Alpha work to be able to participate much in the discussions. Filtering by the user id was an idea I got from Peter Wayne way back in V5 days when we were really struggling to print complex oral surgery office bills and create medical and dental insurance submissions. When the tables got big, we had issues. It evolved to where just about all the invoices and insurance submissions were generated from temp tables, filtered by users. The main difficulty was remembering to synch the clone table structures when the production tables were reconfigured,
              Finian

              Comment


              • #8
                Re: Using Table.open_session in multi user environment

                It turns out the one-record table was pretty much useless for the report because of the inability to print a decent check box without having to create 40 calculated fields to do so. Instead I added a character field with a field rule calc in the template table that fills it with an 'X' when the logical field is .t. Then that field with a border is what is used on the report. Saving the report data is not necessary anyway since the report can be produced on the fly. So no live tables need to be written to, only read and copied to the template table. Therefore using open_session for the template table is probably not necessary.
                Robin

                Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

                Comment


                • #9
                  Re: Using Table.open_session in multi user environment

                  One record temp table is what I use, but it is a local table where all my app is on a server except the temp table which is a live table in the shadow. I just zap the table and then refill as work needs come up. Even though the app is used by 20-40 users at a time, I dreamed of the several issues that could occur if it were on a server. It is only used to print a credit application and a bank contract or lease with Crystal Reports. Yes, Robin, Lightning fast.
                  Dave Mason
                  dave@aldadesktop.com
                  Skype is dave.mason46

                  Comment


                  • #10
                    Re: Using Table.open_session in multi user environment

                    Hi Dave,
                    So when you are developing an app that will be used in a runtime client/server setup - do you mimic the final location for the file on your c:\drive so your scripts can find the right table? Or how do you do this?
                    Robin

                    Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

                    Comment


                    • #11
                      Re: Using Table.open_session in multi user environment

                      Originally posted by MoGrace View Post
                      Hi Dave,
                      So when you are developing an app that will be used in a runtime client/server setup - do you mimic the final location for the file on your c:\drive so your scripts can find the right table? Or how do you do this?
                      I use a join filtered by id to fill the temp table when the print button is pressed. I install the temp table after all other is installed. tabled is made part of the cpanel from autoexec if needed.

                      Pretty simple.
                      Dave Mason
                      dave@aldadesktop.com
                      Skype is dave.mason46

                      Comment


                      • #12
                        Re: Using Table.open_session in multi user environment

                        PMFBI but FWIW, in my current application, every user gets their own sub-folder (off the main app folder) where we store a bunch of temp tables built for specific purposes. The first time the user logs in the user folder is created and the temp tables copied in. After that, on startup, every user gets global variables pointing to the main app folder and to their sub-folder. From time to time we have put also files into the shadow folder on the local machine, but the main thing is that each user can have their own place for temp files.
                        Finian

                        Comment

                        Working...
                        X