Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

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

How to make a table unique and local to each user?

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

    How to make a table unique and local to each user?

    In a multi-user A5 application I have an "extract" table that holds data that a user populates with a selection of records from a customer table. The customer table is, being part of the application master tables, shared by all users of my application of course but I want each extract table to be unique for each user. That is to say each user has their own extract table to populate with customer records however they wish. (They might, for example, each build up an extract table for a particular marketing campaign they are running).

    So my question is how do I name the extract tables? I cannot give them just one name such as "ExtractTable.dbf" because if I did this the table would end up being shared by all users, which is not what I want. I could generate a unique name for each user's extract tables but if I did this the name would have to be created at run time (wouldn't it?) and then I could not define A5 forms, reports, labels etc. because the table only exists at application run time.

    Does anyone have a really good solution to this problem? The solution should provide all my application users their own extract table but yet still allow me to develop A5 sets, forms, reports, labels, etc. against it. And hopefully I only need to do develop these once, not once for every user!.

    Many thanks.

    #2
    Hello Brett,

    I think the approach you should consider would be to simply create a single shared table and then only allow a given user to view, manipulate and report on the records they have added. I would think this could be easily accomplished by having a UserID field in the table/s in question. The other advantage to using this approach is that a given user could use any computer on the network.

    That being said, you can certainly do what you are asking for, but it might be a slippery slope. Couple of approaches:

    A while back we had a couple of articles in the Alpha Newsletter about using Shadow tables as a redirection device. This might be something to consider.

    You could create a 'template table' with all the forms, reports, etc that you would want each individual user's table to have. Now the first time that a newly installed application called for the user's table, create it via xbasic by duplicating the 'template table' in the users private path. This approach would allow the app to be portable, with the caveat of having to recreate the user's individual table on each new system that the app was ported to.

    The down side to having an individual table for each user would be the issue of updates and improvements. If you wanted to make a change or say add a report after the system was in use you'd have to have a well thought out approach to getting this done. Also if a users hard drive went south, you'd loose his local data if it wasn't backed up, and you'd have a different backup for each user (in the sense of their individual table). Also you'd run into some real head scratchers if you wanted these individual tables to be part of sets with tables that were in the shared database on the server. All this is doable but my guess is it will cause you more work and headaches than it is worth.

    All in all, you'll save yourself a ton of work and make the app much easier to maintain and update if you just have a shared table and limit what each user can see to their own records. This is a very common technique using a simple index and queries. The stuff you do all the time in other contexts.

    Good luck,
    Jim

    Comment


      #3
      Jim's message is worth reading a couple times.

      In the event you still want seperate tables, I've done this pretty simply for a couple customers over the years.

      Build your table with reports and whatever else you need. Then create a routine that copies it to the local drive and populates it there. The result is the same table for each user, but seperately populated.

      Another variation I've used is to copy the table (and its dictionaries as needed) to another name. You can use variables such as api_getusername() to create multiple copies of the same table, e.g. Temp_Steve.dbf, Temp_Jim.dbf, etc. You'd probably want to delete the copies when you're done with them.
      -Steve
      sigpic

      Comment


        #4
        In general I agree with Jim and Steve, but would disagree with the suggestion that the tables should be created on the local machine.

        I have subfolders "Workstations" and "Users" in the main application folder, with template tables and files in the top level of each. When a new user or machine logs into the system, a new folder is created for that machine or user in the appropriate location and the tables and files are copied there. They are then easy to access via xbasic and, from my point of view more important, all the application files remain in a single location for easy support, analysis, archiving and backup.

        Finian
        Finian

        Comment


          #5
          Although the advantages of Finian's approach are obvious it will sometimes be thwarted by network security constraints restricting the user from creating or deleting files.

          While I understand that it is possible to selectively relax these constraints I also appreciate the difficulty of convincing MIS departments to do so. If you work in a single organization it is practical but if you hope to install your application in multiple organizations you are taking on a new career.
          Bill Hanigsberg

          Comment


            #6
            To chime in w. the experts, I'll throw my 2-cents in. In my company we have electronic time sheets - a.k.a. an Alpha table in the company database. When each users logs into the db, their user_id and user _level is assigned to global variables. When they open the timesheet table, they only see their own records for the current week. They can also click a ui_popup that displays all of the their own previous weeks and view their time entered. The whole thing uses a query based upon the user_id + w/e date. Conceptually it is very simple and works beautifully.

            See the attached screen shot.
            Peter
            AlphaBase Solutions, LLC

            [email protected]
            https://www.alphabasesolutions.com


            Comment


              #7
              I sympathize with Bill's difficulties with intransigent MIS departments. Make them take responsibility for the user machine backups and they may be more cooperative. Or take responsibility for supporting the application and therefore have to get access to every user machine in order to investigate issues that may arise. That will change a mind or two.

              I'm guessing that in the vast majority of cases getting appropriate access for users within the application folders should not be a problem.

              Finian
              Finian

              Comment


                #8
                Many thanks, guys. Some really good suggestions here. I will print all this off and read it carefully, then decide how I'll do it. Many thanks.

                Comment

                Working...
                X