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

Calculating Time

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

    Calculating Time

    Hi, I posted last week and I am still having trouble. Is there anyone out there that can give me step by step instructions on how to accomplish the following in Alpha Five V11 for a server app.

    I need to set up a dialog box with the following fields:

    Employee
    Job Ticket

    "Repeating Section"

    Date (this is a date field)
    Begining_Time (this is a time field)
    Ending_Time (this is a time field)
    Running_Total (this is a numberic field)

    "and then back to not a repeating section"

    Total_Hours (numeric field)

    I need to know how to get the Running_Total field to display the Begining_Time - the Ending_Time in a numberic field such as the following. The person works from 8:00 to 5:15 I would want the Running Total to show 9.15. This would be 9 hours and 15 min. The date does not matter and does not need to be included in the calculations. The Total_Hours at the bottom would be all of the running totals added together, but I think I know how to do that. I just need to know how to convert the time fields into the running total.

    I am new to alpha and new to coding so it would be so awesome if someone could help me with step by step instructions. Thank you so much. There was a man last week that gave me some instructions but I really can not understand them. I do appreciate his help but I do not understand the coding and do not know how to make it work.

    Thank you.

    #2
    Re: Calculating Time

    You should be able to simply subtract one time from the other. Manipulate the formatting to make it give you what you need.

    time.JPG

    Stephen
    Alpha Anywhere v12.4.6.5.2 Build 8867-5691 IIS v10.0 on Windows Server 2019 Std in Hyper-V

    Comment


      #3
      Re: Calculating Time

      I'm sorry but I don' t know how to do this. I really need step by step instructions on how to accomplish this.

      Thanks

      Comment


        #4
        Re: Calculating Time

        I put the code into the interactive window but I don't know what to do next. I have a feeling that there is a very simple solution to this problem but it is just outside of my reach. It is very frustrating.

        I appreciate very much anyone who can help.

        Comment


          #5
          Re: Calculating Time

          dim workday as d
          dim beginning_time as y
          dim ending_time as y
          dim running_total as n

          workday = {10/10/2012}
          beginning_time = {08:00}
          ending_time = {17:15}
          running_total = ending_time - beginning_time
          ? totime(running_total,1,0)
          = "9:15"
          Gregg
          https://paiza.io is a great site to test and share sql code

          Comment


            #6
            Re: Calculating Time

            Hello,

            I too am building a timecard database to keep track of employees hours. And am also running to issues with the coding with Alpha to display the correct time.

            First off I used the code as demonstrated by Gregg Schmidt, and submitted my variables within the formula, as follows:

            dim TimeIn as y
            dim TimeOut as y
            dim Sutotalhrs as n

            TimeIn = {08:00}
            TimeOut = {17:15}
            SuTotalHrs = TimeIn - TimeOut
            ? totime(sutotalhrs,1,0)
            = "9:15"

            It worked out fine. I am not entirely sure where this coding should go. I placed in the Xbasic Function within my Dialog. I guess my question is Now What? :D

            It's in there but I don't know what I need to do next to get this function properly in a Live Preview. Suggestion?

            Thanks for all the help.

            Comment


              #7
              Re: Calculating Time

              The code needs to be attached to an event (onclick, onchange, onvalidate, aftervalidate), it really depends on how you want your dialog to work.
              Gregg
              https://paiza.io is a great site to test and share sql code

              Comment


                #8
                Re: Calculating Time

                My guess is that I just don't know where to put this code. So I put together a whole bunch of screen shots for everyone :D
                A5 - 1.png
                A5 - 2.png
                A5 - 3.png
                A5 - 4.png
                A5 - 5.png

                If you want other screen shots I can provide them for all of you. Thanks again for all your assistance!

                Comment


                  #9
                  Re: Calculating Time

                  Holly,

                  I would usually put this code either in a onchange event or one of the validate events.
                  One thing to consider is that when working with some form of submit, the values are all text, even though you defined them as something else.

                  Feel free to examine the sample dialog I attached.

                  I do a better job of explaining this on the phone (608)345-2697 and in a teamviewer session.
                  Gregg
                  https://paiza.io is a great site to test and share sql code

                  Comment


                    #10
                    Re: Calculating Time

                    Hey Gregg,

                    Thank you. I have looked over the sample you sent but I cannot locate where you stored the code.....?? Will you be available some time tomorrow for a chat?

                    -Holly

                    Comment


                      #11
                      Re: Calculating Time

                      A picture sometimes is worth much more than 1000 words.
                      Hopefully this one helps.
                      This picture show the code I use in the function, and the event it's attached to.

                      My schedule is very erratic.
                      More often than not, it's best to just call to see what I'm up to.



                      Gregg
                      https://paiza.io is a great site to test and share sql code

                      Comment


                        #12
                        Re: Calculating Time

                        Ok, so I am getting a bit closer. I found where you placed the coding in your sample and I added that same coding to my dialog and changed the variables. However, it is calculating the time as 0:00 - which is more than I was getting before :D

                        But here is another million dollar question.....we have employees that work night shifts. They clock in around 18:00 and clock out at 3am - how would the coding for this look in the Xbasic?

                        Again all of your help is MORE than appreciated!

                        Comment


                          #13
                          Re: Calculating Time

                          Pretty much the same.
                          Thanks to the keepers of javascript, the datetime picker is good except for the day we change to daylight saving time.
                          The work around is to get the date value and time value independently, and then combine them to let alpha5 do the math.
                          I'll use today's date, and the times you gave for the example.
                          Obviously, you would want to change things to work with the dialog, but this gives the general idea.

                          Code:
                          dim beg_date as d
                          dim beg_time as y
                          dim fin_date as d
                          dim fin_time as y
                          
                          beg_date = {10/11/2012}
                          beg_time = {18:00}
                          fin_date = {10/12/2012}
                          fin_time = {03:00}
                          
                          ? totime((fin_date+fin_time)-(beg_date+beg_time),1,0)
                          = "9:00"
                          Gregg
                          https://paiza.io is a great site to test and share sql code

                          Comment


                            #14
                            Re: Calculating Time

                            Then obviously I would need to add Date fields....? Correct?

                            Comment


                              #15
                              Re: Calculating Time

                              Quick easy answer is yes.
                              Gregg
                              https://paiza.io is a great site to test and share sql code

                              Comment

                              Working...
                              X