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 do you get Total Records count in an Xbasic function?

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

    How do you get Total Records count in an Xbasic function?

    I need to write an Xbasic function that checks whether there are any records displayed in a grid (both before or after a search). If no records are displayed, I need to exit the function so that it will not cause an error. Does anyone know how I would get the Total Records value into an Xbasic function?
    Carol King
    Developer of Custom Homebuilders' Solutions (CHS)
    http://www.CHSBuilderSoftware.com

    #2
    Re: How do you get Total Records count in an Xbasic function?

    I cannot believe that I have spent all day trying to accomplish this when I know it must be a simple thing that I'm overlooking. I have put Total Records, Count Records, Record Count, etc., etc., into message board and Wiki search and still don't have a clue. I have tried to study the Xbasic that is generated that shows the Total Records on a grid in order to try to figure it out. But, I am now tempted to throw my computer out the window.....
    Carol King
    Developer of Custom Homebuilders' Solutions (CHS)
    http://www.CHSBuilderSoftware.com

    Comment


      #3
      Re: How do you get Total Records count in an Xbasic function?

      Carol,

      It should be easy but I spent a lot of time trying to figure out how to put the total record count in the navigation bar. If you have a search part, in the AfterSearch event you can use Args.Info.TotalRecords parameter. I then assigned it to an Args.rtc.variable that i could use in other events. I think you can get it in javascript also and you could pass it to an ajaxcallback. A lot of work for something that seems like it should be easy to do.

      PS if you throw your computer out the window make sure nobody is standing underneath.
      Win 10 64 Development, Win 7 64 WAS 11-1, 2, Win 10 64 AA-1,2, MySql, dbForge Studio The Best MySQL GUI Tool IMHO. http://www.devart.com/dbforge/mysql/studio/

      Comment


        #4
        Re: How do you get Total Records count in an Xbasic function?

        This would be my thought.
        TABLECOUNT()
        Syntax
        Number_Of_Records as N = TABLECOUNT( Lookup_Table as C, Filter as C )
        Gregg
        https://paiza.io is a great site to test and share sql code

        Comment


          #5
          Re: How do you get Total Records count in an Xbasic function?

          I think that TABLECOUNT is for counting records in a table, not the current grid after searching or filtering, but I could be wrong. There is a parameter in AfterSearchSubmit client side event called recordsInQuery that I may be able to use to grab the count and send it into the Xbasic function. It's late and I haven't tried it, and I'm wondering if it will work after a QBE search, which, BTW, the afterQBESearch event does NOT have a parameter for the recordsInQuery. I'm tired after a day of this, so will try in morning and report back. It DOES seem like there should be a simple way to do this... I think I'll have to do all these steps just to deal with this... 1 - when grid opens, do a lookup for the query the grid is based on to get the count. 2 - after a search, do a javascript something to get count and send it into Xbasic function. 3 - after a QBE search, do something (what???) to get the count. 3 - after checkboxes are filtered, so something (what???) to get the count. So, HOW DOES ALPHA GET THE {TOTAL_RECORDS} count that shows at the top of the grid anyway???? Should not be such a mystery.
          Carol King
          Developer of Custom Homebuilders' Solutions (CHS)
          http://www.CHSBuilderSoftware.com

          Comment


            #6
            Re: How do you get Total Records count in an Xbasic function?

            I use <%a5 ? tablecount("c:\warehousing\new-ins.dbf","convert_type(mytimestamp,'D')=date()")+" inbound transactions" %> to show how many inbound transactions were entered for today.

            If that doesn't work for you, I did find this note in the AfterSearch Event : 'aa[].text = "alert('Search done. Records found: " + args.info.totalRecords+"');".
            Gregg
            https://paiza.io is a great site to test and share sql code

            Comment


              #7
              Re: How do you get Total Records count in an Xbasic function?

              Originally posted by kingcarol View Post
              I need to write an Xbasic function that checks whether there are any records displayed in a grid (both before or after a search). If no records are displayed, I need to exit the function so that it will not cause an error. Does anyone know how I would get the Total Records value into an Xbasic function?
              It is very hard to answer this question as phrased, because you don't give any context. How is this Xbasic function invoked?

              The most common way in which user defined Xbasic function are called is when a button on a grid is clicked, or some other event fires, that invokes the Grid Object's ajax callback method and the callback specifies the name of the xbasic function that will be invoked on the server to handle the callback.

              I'll therefore presume that that's what you mean.

              When a Grid is executed, (either the initial load, or when any type of search, or page navigation is done), the server obviously knows how many records are in the Grid and it sends that information back to the browser where it is stored in the Grid Object. This mean that any Javascript code you execute can find out how many records are in the current query by reading the value of the {grid.object}._rowsInGrid property.

              When any callback is made to the server, the information is sent back to the server. It is in the __si (short for state info) object that you will see as part of every callback.

              So, to get to the point:

              If you put a debug(1) into your Xbasic function that handles an ajax callback, then run the Grid in Working Preview, then click the button that does the callback, the debugger will open, and you will be able to see that the 'e' object has an e.__si object and inside that you will see:


              e.__si.RecordCount

              which has a count of the current number of records in the grid query.

              Comment


                #8
                Re: How do you get Total Records count in an Xbasic function?

                Thank you, Selwyn. I did do the Working Preview and debug yesterday to search for an e object that had something to do with Record Count, but didn't dig deep enough into the layers of the e object. Now I know to dig down farther.

                I was busy trying to get the count of the records in a grid because I wanted to prevent the Xbasic behind an Action Button from firing if there were no records in the grid. This morning I finally stumbled on another thread that showed the solution for hiding an Action button if there are no records in that grid, and that takes care of my issue. The solution is to put grid.logicalRecordNumber > 0 in the Client Side Show/Hide Expression on the Action Button Editor. Here's a short video of it working: http://screencast.com/t/7MiGq8nT6z
                Carol King
                Developer of Custom Homebuilders' Solutions (CHS)
                http://www.CHSBuilderSoftware.com

                Comment


                  #9
                  Re: How do you get Total Records count in an Xbasic function?

                  Thank you Selwyn, I have been searching for that for a long time,
                  Win 10 64 Development, Win 7 64 WAS 11-1, 2, Win 10 64 AA-1,2, MySql, dbForge Studio The Best MySQL GUI Tool IMHO. http://www.devart.com/dbforge/mysql/studio/

                  Comment


                    #10
                    Re: How do you get Total Records count in an Xbasic function?

                    please remember that there is a wealth of information that is in the e object that is passed into the xbasic function that handles the callback. using the xbasic debugger to explore what's in e is a great way to find out what's there.

                    similarly, using Firebug to see what gets posted back to the server on a callback is another great way to figure out stuff.

                    The combination of the xbasic debugger (when you are in working preview mode) and Firebug, are two invaluable tools for web developers.

                    Comment


                      #11
                      Re: How do you get Total Records count in an Xbasic function?

                      Yup, we love the xbasic debugger.
                      Peter
                      AlphaBase Solutions, LLC

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


                      Comment


                        #12
                        Re: How do you get Total Records count in an Xbasic function?

                        Thank you, I am aware of those tools. Firebug has helped me figure out so many puzzles. I was speaking directly to the e.__si object. I looked through what I thought was all of the nooks and crannies of the e object in the debugger and somehow missed that one.
                        Win 10 64 Development, Win 7 64 WAS 11-1, 2, Win 10 64 AA-1,2, MySql, dbForge Studio The Best MySQL GUI Tool IMHO. http://www.devart.com/dbforge/mysql/studio/

                        Comment


                          #13
                          Re: How do you get Total Records count in an Xbasic function?

                          Wish List - An alphapedia page that lists all the things in the e object, what they capture, and examples of using them in Xbasic code. It would have been wonderful to come across the e.__si.RecordCount by doing a search for record count in the Alphapedia. If there was a page that had a list with e.__si.RecordCount in it, and a description that had the words record count in it, I would have found it quickly. The way it is now we don't know if it's something that might be in the e object or not, then we have to do a debug, then we have to click and expand a ton of stuff just hoping that we find it somewhere amongst abbreviations like si that we're not sure about.
                          Last edited by kingcarol; 10-21-2011, 08:09 AM.
                          Carol King
                          Developer of Custom Homebuilders' Solutions (CHS)
                          http://www.CHSBuilderSoftware.com

                          Comment


                            #14
                            Re: How do you get Total Records count in an Xbasic function?

                            Originally posted by kingcarol View Post
                            Wish List - An alphapedia page that lists all the things in the e object, what they capture, and examples of using them in Xbasic code. It would have been wonderful to come across the e.__si.RecordCount by doing a search for record count in the Alphapedia. If there was a page that had a list with e.__si.RecordCount in it, and a description that had the words record count in it, I would have found it quickly. The way it is now we don't know if it's something that might be in the e object or not, then we have to do a debug, then we have to click and expand a ton of stuff just hoping that we find it somewhere amongst abbreviations like si that we're not sure about.
                            Yes. This chimes in nicely with 1 or 2 other posts about the damn WiKi.

                            http://msgboard.alphasoftware.com/al...010#post587010


                            http://msgboard.alphasoftware.com/al...014#post587014
                            Peter
                            AlphaBase Solutions, LLC

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


                            Comment


                              #15
                              Re: How do you get Total Records count in an Xbasic function?

                              I've been trying to find a solution to return the Total Records in a grid query using Xbasic and I've come across the thread. I want to use it in the OnSQLCountQuery event because I want to add a new record if the grid is blank ( no records ).

                              I found the e.__si.RecordCount method ( or property!!!! ) that seems to have been accepted as the solution. It however
                              does not work for me. In fact, the runtime tells me that this is not a real property. Worst yet is there is NO AUTO COMPLETE to help me determine what methods or properties ARE available.

                              Please help with my two issues:

                              *Why doesn't the e.__si.RecordCount work?

                              *Why does Auto Complete (ie. intellisense) not exist in ALL areas where you can type in Xbasic code?

                              Comment

                              Working...
                              X