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

Table Open Table structure

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

    Table Open Table structure

    Hi There,

    If I define a variable 's_item' as "sop_items_pos_prep" and code Table.open(s_item) it works ok
    If I load the variable 's_item' with a field Table Child from a table 'params_tnm_b' it does not work although debug sees the same result. How do I get to load the table id I require to open, by plugging it into a variable so I can use the same code for opening many tables ?

    I assume the function Table.open requires an id within inverted commas to work

    Can anyone out there in the big wide world help me ?

    Attaching screen dumps

    Looking forward
    Attached Files
    Dave Mac

    It's not so much what you don't know that gets you into trouble, but what you know for sure, that just ain't so. - Mark Twain.

    #2
    Re: Table Open Table structure

    Screen dumps are not as useful as actual code.

    First thought here is that you're forgetting to trim the trailing blanks from the field value you retrieve from the table. If so, your variable contains:

    Code:
    "table_name                   "
    instead of what you want, namely

    Code:
    "table_name"

    Comment


      #3
      Re: Table Open Table structure

      I agree with Tom. Just cut and past the code, instead of screenshots, so we can use it as a foundation to respond. Can't cut and paste your code from screen shots.
      The second line of the commented out table.open() (second pane) uses a variable "s_items_prep" that is nowhere to be found in the code other than there. It wouldn't work not dimmed and undeclared.
      Mike W
      __________________________
      "I rebel in at least small things to express to the world that I have not completely surrendered"

      Comment


        #4
        Re: Table Open Table structure

        Another thought to consider. You don't specify whether this is a standalone or networked app.

        the .pack() method requires exclusive use of the table to perform its duties. Whenever you work out the correct .open() you should include the FILE_RX_EXCLUSIVE parameter and you probably want to throw in a bit of checking to see if it is possible to obtain the table parameter in exclusive mode.

        itmtest = table.in_use("your_table_name")
        if itmtest
        'in use, can't pack
        'warn the user
        else
        ' pack code here, etc
        end if
        There can be only one.

        Comment


          #5
          Re: Table Open Table structure

          Hi Guys,

          Thanks for your prompt response.

          Trim hey, you were right Tom. If I had known that it would have trimmed a few frustrating hours off yesterday. Maybe I should learn to call for help sooner in these cases.

          Apologies for not giving you the complete story. Mike, I will see if i can cut and paste code to you...

          Sorry, not able to see how I can select where to paste my code to you - can you advise (one of the above icons? )

          Also tried to copy my db 'Focus_Universe' to a truncated version of a db 'Mess_board' to attach to you - where I have a few queries - got as far as not being able to duplicate all my Global variables that need to be initialized in Autoexec. How can this be done ?

          Looking forward.
          Dave Mac

          It's not so much what you don't know that gets you into trouble, but what you know for sure, that just ain't so. - Mark Twain.

          Comment


            #6
            Re: Table Open Table structure

            Dave, not a Prophesy but a Prediction.
            Your naming conventions will bite you in the bum in the near future.
            See our Hybrid Option here;
            https://hybridapps.example-software.com/


            Apologies to anyone I haven't managed to upset yet.
            You are held in a queue and I will get to you soon.

            Comment


              #7
              Re: Table Open Table structure

              Originally posted by Ted Giles View Post
              Dave, not a Prophesy but a Prediction.
              Your naming conventions will bite you in the bum in the near future.
              Hi Ted,

              Thanks for the warning.

              What do I need to attend to before the bus falls off the cliff ?

              Looking forward
              Dave Mac

              It's not so much what you don't know that gets you into trouble, but what you know for sure, that just ain't so. - Mark Twain.

              Comment


                #8
                Re: Table Open Table structure

                "sop_items_head_inv_this_some_of_that" would be an example.

                The length of the variable will cause you some confusion in the future. I realise why you are doing it - however you might want to think of a way of simplifying matters.

                If you are happy with the complexity and will be supporting this app all well and good.
                I had to follow a Cobol programmer (my bum) who used the most longwinded approach I have ever come across. It took weeks to unravel what should have been a simple job.
                Your app, your call.
                See our Hybrid Option here;
                https://hybridapps.example-software.com/


                Apologies to anyone I haven't managed to upset yet.
                You are held in a queue and I will get to you soon.

                Comment


                  #9
                  Re: Table Open Table structure

                  Hi Ted,

                  I enclose a screen dump of the variables that I am using. I see that the longest is 17 chars, although my aver var is less than 10 chars.

                  The 's_head_prep' is a table name. Should these be shorter ?

                  Be aware that the 'Prep Parent' column of 'Params_tnm_b' holds the name of tables

                  I need to understand before casually going down the wrong road. Maybe you can give me an example of what I need to change

                  Thanks,

                  Looking forward
                  Attached Files
                  Dave Mac

                  It's not so much what you don't know that gets you into trouble, but what you know for sure, that just ain't so. - Mark Twain.

                  Comment


                    #10
                    Re: Table Open Table structure

                    Code:
                    Apologies for not giving you the complete story. Mike, I will see if i can cut and paste code to you...
                    Sorry, not able to see how I can select where to paste my code to you - can you advise (one of the above icons? )
                    Highlight and Ctrl-C, or Alt-A then Ctrl-C the code in the Code Editor and paste it into the message board window. With code highlighted use the # icon ablove the message board window.
                    Mike W
                    __________________________
                    "I rebel in at least small things to express to the world that I have not completely surrendered"

                    Comment


                      #11
                      Re: Table Open Table structure

                      Dave, I am impressed with the comments in the code. MOST professional.
                      There is a theory that the Field Names are 10 or less. I guess that Table names can be as long as you like, however the simpler the better.
                      I'd probably avoid too similar names, but that's a personal preference to name them for their intended purpose. e.g. Demograph, Invoice, InvHead, InvDet etc.
                      I have had a few seemingly random problems with Alpha Indexing (V9) where the first 6 chars of the field name were the same.
                      You may have the same with Variables - especially if you pick up the wrong one in a dropdown.
                      See our Hybrid Option here;
                      https://hybridapps.example-software.com/


                      Apologies to anyone I haven't managed to upset yet.
                      You are held in a queue and I will get to you soon.

                      Comment


                        #12
                        Re: Table Open Table structure

                        Field names don't have to be 10 or less but they will be bullet-proof if they are. Same goes for index names. The 10 character limit does not apply to any other names.

                        There are limits to other names but they are all over 10. Layout names and, I believe, Operation names are limited to something like 24 characters. Table names are only limited by whatever Windows allows file names to be - which is much larger than I think they should ever be. (But there are potential issues with blank spaces in file names. See the link to my white paper below for more info.)

                        If you handle your files correctly, longer names (there is a limit of something like 24 characters?) won't be an issue. But if you accidentally mess up with some file transfers it can delete all but the first 10 characters of your field and index names. (Note that this is a development issue. It's not something that will happen while your customer is using the database unless they are dumb enough or careless enough to delete files they shouldn't be deleting.)

                        At the request of developers many years ago, Alpha created a way to get around the 10 character limit of DBF files. This means that the long field and index names are not part of the table itself but are instead stored in the data dictionary files. If those files get separated from the data files then you will lose your long field names. You either have to restore those data dictionaries from a backup or recreate the names yourself. In most cases, simply restoring the files from a backup will do the trick but I've seen cases where backups weren't available or were so old as to be unusable with the current table structure.

                        Another thing that people should consider when using long names is that the first 10 characters are key. If you start creating long names like:
                        customer_number
                        customer_name_first
                        customer_name_last
                        customer_name_middle
                        customer_name_suffix
                        customer_name_prefix
                        and something happens to truncate the names, you will end up with 6 names that look like this:
                        customer_n
                        customer_n
                        customer_n
                        customer_n
                        customer_n
                        customer_n

                        If that happens and you are not aware of it, you are likely to get script errors something like "field not found". You might even get some strange warning during the "fixing" process if the Customer_Number field is numeric since all the rest of the fields are obviously character values.

                        Also note that other programs that import your data from the .dbf files will not be able to pick up the long field names. For example, if you try to open a table with the fields in the example above using Excel, you will only see the "customer_n" part of the field names. In this example it's probably not too hard to figure out just be looking at the data in the fields but I've seen situations where that wasn't true. (Exporting to Excel will probably show the long field names - I'm talking about reading the .dbf file directly using any 3rd party program.)

                        I personally stick to the 10 character max philosophy but I know many people that don't. And many of those people don't have any problem. However, I've had - and seen - enough problems in the past that I prefer using a method that eliminates all worries about truncating names.

                        For more of my thoughts and rationale on naming issues, see this "white paper" I did a few years ago. Even if you don't agree with specific recommendations, you will at least have a better understanding of the potential issues.

                        One thing that isn't addressed in that paper is the idea of avoiding the use of names that are - or should be - reserved names. I've seen that kind of thing happen a lot although I can't think of any specific examples right now other than the obvious things like built-in function names. (Maybe I'll start compiling a list of what ought to be reserved words and add it to my paper - suggestions welcome.)
                        Last edited by CALocklin; 08-31-2011, 05:24 PM.

                        Comment


                          #13
                          Re: Table Open Table structure

                          I generally stick to the old 8.3 dos naming of any files and 10 or less for everything else except variables and I try to stay under 12 with them. It does simplify most things I do or when I have to go back into it later.

                          Remember the old days when more than 8 of anything was very bad and got worse. That is the era I came from and it is hard to change spots.
                          Dave Mason
                          [email protected]
                          Skype is dave.mason46

                          Comment


                            #14
                            Re: Table Open Table structure

                            Thanks for the input Guys. Cal, I need to go back to many of my tables and clean them up. Are you reasonably sure that Alpha5 directories are able to manage with all field and file name changes that are made without going up the wall ?

                            With your Aims program that I use, it occurred to me that if your program can locate all occurrences of 'Trade_transactions' (which it does), can it not go a step further and alter all those located to 'Trde_xact' ?

                            Looking forward
                            Dave Mac

                            It's not so much what you don't know that gets you into trouble, but what you know for sure, that just ain't so. - Mark Twain.

                            Comment


                              #15
                              Re: Table Open Table structure

                              Dave,
                              If it was my problem, I'd replicate what you have and change the replica.
                              The trouble with the copy routine is that you will - if chosen - get duplicate Forms.
                              You might be better off copying the whole database folder to a new one and working on that.
                              How many Tables and associated Forms will you need to change?
                              If you truncate, as has been commented upon, you will find it easier to follow the logic of the Forms and
                              Scripts.
                              See our Hybrid Option here;
                              https://hybridapps.example-software.com/


                              Apologies to anyone I haven't managed to upset yet.
                              You are held in a queue and I will get to you soon.

                              Comment

                              Working...
                              X