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

Is there a better way than using form calc fields

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

    Is there a better way than using form calc fields

    Attached is a picture of an entry screen used in a payroll application in many states.
    Customer wants summary of hours by craft codes (051,052,453,452,451 etc.)
    to show on the screen as they enter records into an embedded browse.
    Craft codes could be up to 8 characters but the summary would be only the first 3 digits. (substr(craft,1,3))

    Craft codes could be as little as 10 and as many as 100.
    I was testing with calculated fields on the form and it works, but I do not want to add calculated fields everytime the user adds a new craft.

    The data entry screen is actually a set with a header and detail linked by sheet number. The hours for the crafts are totals of that sheet only.

    I could append unique to a table each time the user changes rows in the embedded browse, but on some networks there could be up to 6-8 users entering data. The append unique would slow the application down.

    Any ideas on how to show the total hours by craft code for each sheet as the user enters data. Again if the user enters a new craft code for that sheet, I do not want to have to add calculated field.

    #2
    Re: Is there a better way than using form calc fields

    Originally posted by crimmelcp View Post
    Attached is a picture of an entry screen used in a payroll application in many states.
    Customer wants summary of hours by craft codes (051,052,453,452,451 etc.)
    to show on the screen as they enter records into an embedded browse.
    Craft codes could be up to 8 characters but the summary would be only the first 3 digits. (substr(craft,1,3))

    Craft codes could be as little as 10 and as many as 100.
    I was testing with calculated fields on the form and it works, but I do not want to add calculated fields everytime the user adds a new craft.

    The data entry screen is actually a set with a header and detail linked by sheet number. The hours for the crafts are totals of that sheet only.

    I could append unique to a table each time the user changes rows in the embedded browse, but on some networks there could be up to 6-8 users entering data. The append unique would slow the application down.

    Any ideas on how to show the total hours by craft code for each sheet as the user enters data. Again if the user enters a new craft code for that sheet, I do not want to have to add calculated field.
    It is late for me and this may be a little out because I haven't tried it out. How about a browse of a table of craft codes and calculated fields (dbsum() or tablesum()) to the right where your totals are now? Not sure what the performance hit would be for recalculating the calculated fields based on some event.
    There can be only one.

    Comment


      #3
      Re: Is there a better way than using form calc fields

      Charlie,

      What if you use the OnFetch event of the embedded browse object to run a script that reads the current craft code & sheet number and then computes the total? The displayed result would change as the user navigates from row to row. You wouldn't show all the totals for all the craft codes in the sheet, just the total for the row that's currently selected. If performance over the LAN is an issue maybe you could keep a running total for each craft code in the sheet using an array, and change the element from the array that's displayed as the user fetches through the browse?

      Comment


        #4
        Re: Is there a better way than using form calc fields

        Attached is a sample entry screen using calculated fields

        Trying to find a better way

        Charlie Crimmel

        Comment


          #5
          Re: Is there a better way than using form calc fields

          I think Tom is on to something. Does the OnSave form event fire when you save an embedded browse record? If not, you might just put it into field rules and only fire the script when the object exists - or, use a dialog for the browse data entry (make the browse read only).

          In any event (no pun intended), you might need two scripts:
          1. when you first load the record: loop through the child records and assign array variables for each Craft code and for each value, and total in the script. Display as variables (or my favorite, text objects) on the form.
          2. Using the OnSave event as suggested above, fire a script that appends the latest Craft code & totals, and update the form display.


          Since there will be a finite number of craftcodes related to one parent record, you should be able to manage the display area on the form w/o too much difficulty. A little bit of coding, for sure, but the results will be instantaneous!
          Peter
          AlphaBase Solutions, LLC

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


          Comment


            #6
            Re: Is there a better way than using form calc fields

            Recently I have been helping someone with an app with large files (2.6 million records in one of the child tables and large quantities in all tables) and have been experimenting with ways to make things work faster. Calculated fields and form sort orders put a big load on the system. For calculated fields like you are describing I am experimenting with a post operation to counter fields, as for crafts. And possibly a nightly routine to reset them manually once a day.

            For the record, I have discovered that it is faster to use an index for sorting and filtering than to use the form for it. But you have to experiment with how much time is added to the new record save when you add an index against how much time it saves with the form.

            PS: good to see you around again Charlie - hadn't seen you here for ages!!
            Cole Custom Programming - Terrell, Texas
            972 524 8714
            [email protected]

            ____________________
            "A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw

            Comment


              #7
              Re: Is there a better way than using form calc fields

              No luck yet.
              The script builds the initial aaray with the craft codes, but I cannot get the hours to build correctly for each craft code.

              Tried an summary operation with the result table linked in the set to the header table by sheetno.
              But because I am running the operation from the form, I am having record locking problems and not getting the correct info.

              Any other ideas?
              Charlie Crimmel

              Comment


                #8
                Re: Is there a better way than using form calc fields

                What Tom and Peter said.

                Use the OnSave event and Xbasic for a little looping through the detail file. Use an appropriate index so you can build a value like this:

                Code:
                t = table.current()
                key = t.myfieldvalue
                
                tDetail = table.open("whatevertable")
                tDetail.index_primary_put("IndexName")
                tDetail.fetch_find(key)
                KeyValue = 0
                While tDetail.fieldname = key .and. .not. tDetail.fetch_eof()
                 KeyValue = KeyValue + tDetail.OtherFieldName
                 tDetail.fetch_next()
                End while
                This runs faster than you can imagine, and several people doing data entry will hardly affect it.

                Use the resulting values for display.

                Another approach is even simpler, and potentially faster.

                Code:
                filter = "SomeField = SomeValue"
                MyVar = tablesum("Tablename", "Field", filter)
                (I think that's the syntax)
                I just did a report that gathers up about 60 different values, mostly with this latter approach, and it takes no time at all.

                I know these are a bit general, but these methods, probably with modifications for your needs, can get a lot of values fast.
                -Steve
                sigpic

                Comment

                Working...
                X