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

Browse Table Item Number

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

    #16
    Re: Browse Table Item Number

    Keith,
    Note that the run_count is not being used in the field rules as yours is---I have used these "report functions" many times outside of reports but since the documentation states very plainly that
    ...not intended for table level field rules...
    I have not attempted such in field rules.....not that you would change your current code but just in case you might want to use this in a future endeavor.
    Mike
    __________________________________________
    It is only when we forget all our learning that we begin to know.
    It's not what you look at that matters, it's what you see.
    Henry David Thoreau
    __________________________________________



    Comment


      #17
      Re: Browse Table Item Number

      Hi Mike,

      I cant see where I have used Run_Count(). This looks like it was Gabe's suggestion.

      I must give credit to Dr Peter Wayne for the code I have used and it works very well.
      Regards
      Keith Hubert
      Alpha Guild Member
      London.
      KHDB Management Systems
      Skype = keith.hubert


      For your day-to-day Needs, you Need an Alpha Database!

      Comment


        #18
        Re: Browse Table Item Number

        I have been playing with this and have attached an example. I can't see where either method works well. I didn't use Keith's yet, that is next. The 4 calculated line nuber fields in the parent-child set for slows the program to a near halt, but still shows the problems with both Tom's and my methods. It seems to matter if it's use is in a child versus a parent browse. I don't see either working completely.
        Mike W
        __________________________
        "I rebel in at least small things to express to the world that I have not completely surrendered"

        Comment


          #19
          Re: Browse Table Item Number

          Mike W, the only problems I see with your example are these:

          a) slowness - I think this is due to the many run_count() calcs that you've got running concurrently. BTW, the speed can be improved a bit if you add the GRP parameter to all calls, including those affecting only the parent table.

          b) the wrong line counter appears, provisionally, when a new record is begun, but is corrected as soon as the pending new record is saved.

          Both of these seem pretty much what I would expect. Am I missing something?

          My testing has been done with build 1884_3220. BTW, using the Invoice form in AlphaSports, which has a browse for the linked items records, I don't see any duplication of line numbers using the calc display expression I suggested elsewhere above. However, when the user begins a new item record the calc field rule is evaluated and uses the previous line number while the row is being filled in. When the row is saved the line count is displayed correctly. If this makes you nervous don't do data entry in the browse, use a popup dialog or a second form.
          Last edited by Tom Cone Jr; 12-08-2008, 03:33 PM.

          Comment


            #20
            Re: Browse Table Item Number

            Keith,
            As an alternative was shown you using run_count(), I just wanted to make sure you were aware of a possible limitation or glitch that may be found if you tried the run_count function in field rules as you use your current code is all...not even sure you can use it there thinking about it!! :)
            Mike
            __________________________________________
            It is only when we forget all our learning that we begin to know.
            It's not what you look at that matters, it's what you see.
            Henry David Thoreau
            __________________________________________



            Comment


              #21
              Re: Browse Table Item Number

              Hi Mike,

              Just as a matter of interest, in V6 Alphasports->Invoice there was a calculated field put into the browse to give a row number:
              run_count = run_count(Invoice_Items->Product_Id,GRP->INVOICE_HEADER)
              Not quite sure if it renumbered the rows if an item was deleted.

              The disadvantage of that was you could not use the row number as a field in a report.

              Not sure when the run_count() was no longer to be used on forms?
              Regards
              Keith Hubert
              Alpha Guild Member
              London.
              KHDB Management Systems
              Skype = keith.hubert


              For your day-to-day Needs, you Need an Alpha Database!

              Comment


                #22
                Re: Browse Table Item Number

                Keith,

                Not sure when the run_count() was no longer to be used on forms?
                This has been a matter of contention amongst many here as the help file is a bit vague in my opinion. As far as I am concerned a function that is referred to as mainly a report function should be used in moderation, and the only definite places the documentation states it should not be used is in the field rules or in expressions. Many use count, run_count, etc. on forms with no problems as far as I have heard.
                Mike
                __________________________________________
                It is only when we forget all our learning that we begin to know.
                It's not what you look at that matters, it's what you see.
                Henry David Thoreau
                __________________________________________



                Comment


                  #23
                  Re: Browse Table Item Number

                  So... this thread is still going!
                  Forget about run_count()
                  1-Add a blank field, numeric, character, whatever suits you apetite in the table. Let's call it: Rank.
                  2-Put this script in the OnFetch event (and in the OnSave event as well) of the form:
                  Code:
                  dim counter as n=1
                  t=table.current(...the child table slot #..)
                  x=tablecount("child_Table","linking_field="+linking_field)
                  for i=1 to x
                  t.change_begin()
                  t.rank=counter
                  t.change_end(.t.)
                  counter=counter+1
                  next
                  topparent.resynch()
                  P.S.
                  Untested script.

                  Comment


                    #24
                    Re: Browse Table Item Number

                    I got this thread started originally & solved my "Item #" problem with something similar to:

                    run_count = run_count(Invoice_Items->Product_Id,GRP->INVOICE_HEADER)

                    It works in an embedded form & handles adding & deleting records well so far; it also works on a form too. I have just logged in again & was surprised at all the additional posts. I appreciate all the help here.

                    Comment


                      #25
                      Re: Browse Table Item Number

                      Needless to say, the script I posted will not work as such. You need to add few lines to fetch_first, fetch_next().

                      Alternative script:
                      1-Add a field as mentioned above
                      2-Put this script in the Onfetch (+ OnSave):
                      Code:
                      dim counter as n=0
                      browse1.activet()
                      browse1.fetch_first()
                      browse1:colum_title.value=1
                      while .not.browse1.eof()
                      browse1.fetch_next()
                      browse1:colum_title.value=counter
                      counter=counter+1
                      end while
                      I could tell you without testing, it will be slow.

                      So, here is another script:
                      Code:
                      t=table.open("child")
                      t.query_create(..use same filter and order of the child as in the form)
                      dim counter as n=1
                      t.fetch_first()
                      while .not. t.fetch_eof()
                      t.change_begin()
                      t.rank=counter
                      t.change_end(.t.)
                      counter=counter+1
                      end while
                      None of these scripts were tested and might need some tweaking.

                      Comment

                      Working...
                      X