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

Tablecount variable

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

    Tablecount variable

    I am working from a form to an external table not in a set with the form table.
    this is the help file example:
    TABLECOUNT("PURCHASE.DBF","MANAGER = '" + vManager + "' ")
    this what I wrote:
    tablecount("Children.dbf ","ChClient_Id=' "+VClientId+" ' ")

    this is the error that is sent back

    Error:
    expression_result= eval("tablecount('children.dbf','chlient_id='[unknown DOS error]C:\alpha Databases\Wills1\+VClientId+.dbf

    I don�t understand this error except it seems there is something wrong with the variable desription.

    if I write:
    tablecount("Children.dbf ",".T.")

    My script will correctly get the number of records in the table on the form and in the external "children" table
    using the xbasic enter record action which is what the rest of the script is about. So that seems to work.

    but I need to get the count of records just for a particular client not the whole table.

    in the action script I set the client Id on the form to a variable
    then I set the N relationcount field which is done through the action script to the tablecount function using the variable
    but I can never get it to work even though I can get a 0 on the expression builder as a result which is the wrong count.

    I can only think there is something wrong with the varible description, syntax, refresh or I don`t know
    I have tried all kinds of things to no avail.
    any insight will be appreciated
    Thanks George Kenney

    #2
    Re: Tablecount variable

    Does your script assign a field value to the vClientId variable?

    Do the data types of your fields and variables match?

    Are the table and field names spelled correctly?

    Comment


      #3
      Re: Tablecount variable

      Originally posted by Tom Cone Jr View Post
      Does your script assign a field value to the vClientId variable?

      Do the data types of your fields and variables match?

      Are the table and field names spelled correctly?
      Tom thanks for your quick reply I have rechecked all.
      1. my script assigns the field value from the assignment form
      which is based on the assignment table as a global variable
      in the action script set variable to field on form

      2.The data types of the field on the form match the value of the variable as character type.

      3. I believe the table and field names are spelled correctly.
      I get the table name from the dropdown in the tablecount function of the expression builder I keep looking for some abnormality and it is good to keep looking. hmmmmm.

      I actually thought that the function wouldn�t address a table
      outside a set but then I got it to work on the whole table.
      with tablecount("children",".T.") the rest of the script flowed on through.
      there must be something wrong with the variable part. I tried
      to use a Dim in the action script at the top but it had no effect. Maybe it is my spanish keyboard eventhough I get the same look of character. I mean I just don�t know I�LL try the function on another table in another database.

      Comment


        #4
        Re: Tablecount variable

        This should be (relatively) easy to fix. Can you post a stripped down copy of the database here so we can study it?

        Comment


          #5
          Re: Tablecount variable

          What scope did you assign to the vClientId variable?

          Why not just use a calculated field on the form?
          Last edited by Stan Mathews; 06-18-2009, 08:35 AM.
          There can be only one.

          Comment


            #6
            Re: Tablecount variable

            Originally posted by Stan Mathews View Post
            What scope did you assign to the vClientId variable?

            Why not just use a calculated field on the form?
            Thanks for your response I don�t think a calculated field
            will do me because I am trying to do this for a whole list
            of tables. the tables are not in the set or related to the
            assignment form as I have too many. I use a drop down list
            with a branch script and then run a message box to run the
            particular list selected script this is where I thought to
            put the tablecount function.
            thanks
            George Kenney

            Comment


              #7
              Re: Tablecount variable

              Originally posted by Tom Cone Jr View Post
              This should be (relatively) easy to fix. Can you post a stripped down copy of the database here so we can study it?
              Tom Thanks for the offer
              It took me a bit to strip down the database to just
              what is needed I suppose. I have tried to get the tablecount
              function to work with a variable but I can�t seem to get it
              to happen. maybe I am suppose to use a quote function with
              it the client Id is character and the VclientId is character.
              the field the function returns to is a numeric field. I am reaching out to an external table but I can�t get it to work on
              a related table either I am probably mixing apples and pears somewhere. if you could be so kind to look at this I would appreciate it.
              Thanks
              George Kenney

              Comment


                #8
                Re: Tablecount variable

                I think there is a problem in the way the action scripting genie is translating single and double quotes. Action scripting needs to account for the various places from where someone might run the code so it uses the eval() function to facilitate this. The eval() function takes a character expression. It looks like the genie is not translating the expression into a character string properly. I was sure that in the past the string in the eval function would have the escape character (\) placed in the appropriate spots.

                This seems to be the similar to this thread. http://msgboard.alphasoftware.com/al...ad.php?t=80045
                I would report this as a bug.

                For now this seems to work.
                Code:
                tablecount("Children.dbf ","ChClient_Id= "+quote(vClientId1))
                Another work around is to convert the action to inline xbasic and modify the expression there to what you initially tried.
                Code:
                expression_result =  tablecount("Children.dbf","ChClient_Id= '"+ vClientId1+"'")
                Tim Kiebert
                Eagle Creek Citrus
                A complex system that does not work is invariably found to have evolved from a simpler system that worked just fine.

                Comment


                  #9
                  Re: Tablecount variable

                  Tim, I concur. The Action Scripting editor is mangling the tablecount() expression that George supplied to the genie.

                  George, you can see this if you highlight the action and then click the spectacles on the toolbar to "examine" the xbasic code the editor is generating. Notice that many of your quote marks have become apostrophes. This is being done to accommodate the eval() function's use, but it's implemented badly.

                  I hope you'll send a copy of this database example to Alpha with a formal bug report. Use the "Send a Bug Report" option on the Alpha Five Help menu. Include detailed directions for them to follow (using actual form and button names) so that they can easily find and replicate the problem on their equipment.

                  Incidentally, George, the examples you found in the help file discussion of the tablecount() function were written long ago. If memory serves they were written before the quote() and s_quote() functions became available to us. When time permits maybe I'll update the examples to use these functions.

                  -- tom

                  Comment


                    #10
                    Re: Tablecount variable

                    Originally posted by Tim Kiebert View Post
                    I think there is a problem in the way the action scripting genie is translating single and double quotes. Action scripting needs to account for the various places from where someone might run the code so it uses the eval() function to facilitate this. The eval() function takes a character expression. It looks like the genie is not translating the expression into a character string properly. I was sure that in the past the string in the eval function would have the escape character (\) placed in the appropriate spots.

                    This seems to be the similar to this thread. http://msgboard.alphasoftware.com/al...ad.php?t=80045
                    I would report this as a bug.

                    For now this seems to work.
                    Code:
                    tablecount("Children.dbf ","ChClient_Id= "+quote(vClientId1))
                    Another work around is to convert the action to inline xbasic and modify the expression there to what you initially tried.
                    Code:
                    expression_result =  tablecount("Children.dbf","ChClient_Id= '"+ vClientId1+"'")
                    Tim
                    Thanks so much I don�t think I would have ever figured this out.
                    I was starting to think that the quote function might have something to offer as I had seen it in other examples of the tablecount function but I thought it just turned whatever into a character object I had looked them up in help but I kept thinking it had something to do with my variable
                    the scope, the name, where it came from or something.
                    I could see in the error message that the qoutes were
                    not being reflected in the eval statment just single qoutes but I didn�t know if that was normal or not. I tried looking at the code but I don�t know enough about code to see anything unusual.
                    Anyway I really apperciate your help
                    George Kenney

                    Comment


                      #11
                      Re: Tablecount variable

                      Originally posted by Tom Cone Jr View Post
                      Tim, I concur. The Action Scripting editor is mangling the tablecount() expression that George supplied to the genie.

                      George, you can see this if you highlight the action and then click the spectacles on the toolbar to "examine" the xbasic code the editor is generating. Notice that many of your quote marks have become apostrophes. This is being done to accommodate the eval() function's use, but it's implemented badly.

                      I hope you'll send a copy of this database example to Alpha with a formal bug report. Use the "Send a Bug Report" option on the Alpha Five Help menu. Include detailed directions for them to follow (using actual form and button names) so that they can easily find and replicate the problem on their equipment.

                      Incidentally, George, the examples you found in the help file discussion of the tablecount() function were written long ago. If memory serves they were written before the quote() and s_quote() functions became available to us. When time permits maybe I'll update the examples to use these functions.

                      -- tom
                      Tom
                      Thanks for your help with this I will try to send in the bug report people complain about the help files but I have seen other help files and Alpha is head and shoulders above the rest. At least after reading a help file in Alpha you actually have a clue as to what to do and you don�t have to reread it three times to realize you don�t know what they are
                      talking about. There are so many man hours in
                      those help files I don�t see how it could ever be updated.
                      Thanks so much
                      George Kenney

                      Comment

                      Working...
                      X