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

Time calculation display as negative...

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

    Time calculation display as negative...

    Hello -

    For the past several months we have been entering time (am/pm) and it is calculating correctly when you enter in AM to PM.

    My calcs are:
    Code:
    WaitTime = ((TOSECONDS(Inv_Test->Outime)-TOSECONDS(Inv_Test->Intime))/3600)-.5
    Hours    = round((TOSECONDS(Inv_Test->Hrout)-TOSECONDS(Inv_Test->Hrin))/3600,2)
    HRTTL    = calc->Hours*Inv_Test->Hrlyrate
    PlantWT  = ((TOSECONDS(INV_TEST->OUTIME)-TOSECONDS(INV_TEST->INTIME))/60)-30
    I know there has to be a way to multiply by a neg 1 or something so that this doesn't occur? We circumvented by enter his times backwards - but it is not true hours when we print etc...

    Any suggestions?
    ~george
    Last edited by AaronBBrown; 06-06-2006, 05:15 PM.

    #2
    Originally posted by czar_g
    Hello -

    For the past several months we have been entering time (am/pm) and it is calculating correctly when you enter in AM to PM.

    My calcs are:
    WaitTime = ((TOSECONDS(Inv_Test->Outime)-TOSECONDS(Inv_Test->Intime))/3600)-.5
    Hours = round((TOSECONDS(Inv_Test->Hrout)-TOSECONDS(Inv_Test->Hrin))/3600,2)
    HRTTL = calc->Hours*Inv_Test->Hrlyrate
    PlantWT = ((TOSECONDS(INV_TEST->OUTIME)-TOSECONDS(INV_TEST->INTIME))/60)-30

    I know there has to be a way to multiply by a neg 1 or something so that this doesn't occur? We circumvented by enter his times backwards - but it is not true hours when we print etc...

    Any suggestions?
    ~george
    "multiply by a neg 1 or something so that this doesn't occur?" - so that what doesn't occur?
    There can be only one.

    Comment


      #3
      sorry must have deleted the part of my message.

      when you enter in 08:00 am - 02:00 pm it calculates out as 6 hrs..
      when you enter in 08:00 pm - 02:00 am it calculates out as -6 hrs..
      they do not have anyone working like this to often - however - every so often...

      thanx
      George

      Comment


        #4
        Originally posted by czar_g
        sorry must have deleted the part of my message.

        when you enter in 08:00 am - 02:00 pm it calculates out as 6 hrs..
        when you enter in 08:00 pm - 02:00 am it calculates out as -6 hrs..
        they do not have anyone working like this to often - however - every so often...

        thanx
        George
        Hard to test without your tables but I think

        Code:
        PlantWT = if(((TOSECONDS(INV_TEST->OUTIME)-TOSECONDS(INV_TEST->INTIME))/60)-30>0,((TOSECONDS(INV_TEST->OUTIME)-TOSECONDS(INV_TEST->INTIME))/60)-30,((TOSECONDS(INV_TEST->INTIME)-TOSECONDS(INV_TEST->OUTIME))/60)-30)
        There can be only one.

        Comment


          #5
          no sir -
          what files are needed?

          i have this zip file... will this work?

          George
          Last edited by czar_g; 06-02-2006, 03:25 PM.

          Comment


            #6
            It seems like the simple answer is: if the value is negative, add 12 hours.

            Comment


              #7
              It would seem so - can i trouble you to look at the zip i attached and show me? I tried adding IF statements galore and each one says its invalid - i have no hair left...

              I tried this:
              Code:
               PlantWT  = if(((TOSECONDS(INV_TEST->OUTIME)-TOSECONDS(INV_TEST->INTIME))/60)-30<0,(((TOSECONDS(INV_TEST->OUTIME)-TOSECONDS(INV_TEST->INTIME))/60)-30)+12,((TOSECONDS(INV_TEST->INTIME)-TOSECONDS(INV_TEST->OUTIME))/60)-30)
              But that is not correct-

              I'm going to have to add the same thing in a whole boatload of my reports as well..

              QQ - Is this case where you would enter in all your calculations and make them Global. I know this isn't on the same subject - but thought i'd ask.

              thanx
              George
              Last edited by AaronBBrown; 06-06-2006, 05:14 PM.

              Comment


                #8
                Originally posted by Edward Larrabee
                It seems like the simple answer is: if the value is negative, add 12 hours.
                Looks like Ed's suggestion is best, in spite of what they say about him.

                For hours you can use

                Code:
                if(round((TOSECONDS(Inv_Test->Hrout)-TOSECONDS(Inv_Test->Hrin))/3600,2)>=0,round((TOSECONDS(Inv_Test->Hrout)-TOSECONDS(Inv_Test->Hrin))/3600,2),round((TOSECONDS(Inv_Test->Hrout)-TOSECONDS(Inv_Test->Hrin)+toseconds("12:00"))/3600,2))
                Last edited by Stan Mathews; 04-26-2006, 05:45 PM.
                There can be only one.

                Comment


                  #9
                  Hi stan

                  I'm sorry but I changed my hours calc to
                  Code:
                  if(round((TOSECONDS(Inv_Test->Hrout)-TOSECONDS(Inv_Test->Hrin))/3600,2)>=0,round((TOSECONDS(Inv_Test->Hrout)-TOSECONDS(Inv_Test->Hrin))/3600,2),round((TOSECONDS(Inv_Test->Hrout)-TOSECONDS(Inv_Test->Hrin)+toseconds("12:00"))/3600,2))
                  And in the table it still displays a negative...
                  08:00 p to 02:00 a --- should show 6 hours
                  it shows as -18 --- I know its probably something I'm doing...

                  George
                  Last edited by AaronBBrown; 06-06-2006, 05:13 PM.

                  Comment


                    #10
                    Originally posted by czar_g
                    Hi stan

                    I'm sorry but I changed my hours calc to
                    Code:
                    if(round((TOSECONDS(Inv_Test->Hrout)-TOSECONDS(Inv_Test->Hrin))/3600,2)>=0,round((TOSECONDS(Inv_Test->Hrout)-TOSECONDS(Inv_Test->Hrin))/3600,2),round((TOSECONDS(Inv_Test->Hrout)-TOSECONDS(Inv_Test->Hrin)+toseconds("12:00"))/3600,2))
                    And in the table it still displays a negative...
                    08:00 p to 02:00 a --- should show 6 hours
                    it shows as -18 --- I know its probably something I'm doing...

                    George
                    I tried it as a calculated field on a form based on the table and I thought it worked but who knows.

                    Specify for us where you want to define the calculation and where you want to see the result. I found no table level field rule which would define the calculation.

                    Example:

                    I have a table inv_test
                    I have a field rule in this table for the field "hours".
                    The field is defined as calculated with the expression yada-yada
                    When I enter values "08:00 a" and "02:00 p" into fields "hrin" and "hrout" I expect and see the hours calculated field to show 6.00.
                    When I enter values "08:00 a" and "02:00 a" into fields "hrin" and "hrout" I also want the hours calculated field to show 6.00 because my users can't always perform the data entry correctly and may make mistakes.
                    Describe and name any forms or browses involved.

                    Any less explanation than this just leaves us guessing as to what you see and what you want.
                    Last edited by AaronBBrown; 06-06-2006, 05:14 PM.
                    There can be only one.

                    Comment


                      #11
                      Look - I apologize for not being the Alpha5 guru as everyone else.
                      I'm a simple disabled user and don't always convey properley.
                      I thought I was doing fine, but I suppose not.

                      As you can see by the file I submitted with the table/form.
                      It contains HRIN/HROUT
                      When I enter values "08:00 A" and "02:00 P" into fields "hrin" and "hrout" I expect and see the hours calculated field to show 6.00 in the HOURS field.
                      BUT when I enter values "08:00 P" and "02:00 A" (notice the reversal of AM/PM) into fields "hrin" and "hrout" I also want the hours calculated field to show 6.00 in the HOURS field. Currently the calc shows -6. The field HOURS multiplied by HOURLYRATE to calculate the individuals pay. With the HOURS field calculating incorrectly and showing negative(-6) the pay doesn't show correctly -6 x $35 = $-210 (they owe us money).

                      I've applied the calculation -
                      Code:
                      if(round((TOSECONDS(Inv_Test->Hrout)-TOSECONDS(Inv_Test->Hrin))/3600,2)>=0,round((TOSECONDS(Inv_Test->Hrout)-TOSECONDS(Inv_Test->Hrin))/3600,2),round((TOSECONDS(Inv_Test->Hrout)-TOSECONDS(Inv_Test->Hrin)+toseconds("12:00"))/3600,2))
                      to the field rules for HRS and the calc is coming out as the proper amount of hours but shows - (negative) -6 intead of (positive) 6. They have a simple mask and are defined as Character.

                      I don't want you/anyone to guess -
                      Like I said before I thought I was doing okay.
                      I hope the above may explain further.

                      Thanks...
                      George
                      Last edited by AaronBBrown; 06-06-2006, 05:15 PM.

                      Comment


                        #12
                        No offense meant and if taken, I apologize.

                        All I meant is that without an explanation we can only guess how to duplicate your problem.

                        Your first post read to me as if you wanted a new expression for
                        Code:
                        PlantWT = ((TOSECONDS(INV_TEST->OUTIME)-TOSECONDS(INV_TEST->INTIME))/60)-30
                        to eliminate the negative values.

                        Your second post included the information
                        when you enter in 08:00 am - 02:00 pm it calculates out as 6 hrs..
                        when you enter in 08:00 pm - 02:00 am it calculates out as -6 hrs..
                        but not information as to where to enter the values. Hrin and hrout or intime and outime? You know how you want it to work and it may seem perfectly logical to you but we have to be led through the process.

                        Your attachment is missing the support files for the inv_test.dbf so your form is not present. It is also missing the testtime.alx so the database itself is incomplete.

                        Take a look at my attachment and see if the simple form I created does what you want. I probably have messed up the calculations for waittime and plantwt but am unsure of what results should flow. (You can also note the files included in my zip attachment to see what needs to be included.)

                        Hope this gets you going again.
                        Originally posted by czar_g
                        Look - I apologize for not being the Alpha5 guru as everyone else.
                        I'm a simple disabled user and don't always convey properley.
                        I thought I was doing fine, but I suppose not.

                        As you can see by the file I submitted with the table/form.
                        It contains HRIN/HROUT
                        When I enter values "08:00 A" and "02:00 P" into fields "hrin" and "hrout" I expect and see the hours calculated field to show 6.00 in the HOURS field.
                        BUT when I enter values "08:00 P" and "02:00 A" (notice the reversal of AM/PM) into fields "hrin" and "hrout" I also want the hours calculated field to show 6.00 in the HOURS field. Currently the calc shows -6. The field HOURS multiplied by HOURLYRATE to calculate the individuals pay. With the HOURS field calculating incorrectly and showing negative(-6) the pay doesn't show correctly -6 x $35 = $-210 (they owe us money).

                        I've applied the calculation -
                        Code:
                        if(round((TOSECONDS(Inv_Test->Hrout)-TOSECONDS(Inv_Test->Hrin))/3600,2)>=0,round((TOSECONDS(Inv_Test->Hrout)-TOSECONDS(Inv_Test->Hrin))/3600,2),round((TOSECONDS(Inv_Test->Hrout)-TOSECONDS(Inv_Test->Hrin)+toseconds("12:00"))/3600,2))
                        to the field rules for HRS and the calc is coming out as the proper amount of hours but shows - (negative) -6 intead of (positive) 6. They have a simple mask and are defined as Character.

                        I don't want you/anyone to guess -
                        Like I said before I thought I was doing okay.
                        I hope the above may explain further.

                        Thanks...
                        George
                        Last edited by AaronBBrown; 06-06-2006, 05:14 PM.
                        There can be only one.

                        Comment


                          #13
                          I'm about to go postal - It's THIS close...

                          I zpped the files I had in the test directory that I'm working with.
                          Sorry, but can I do something in order to make sure I'm givin all that is required?
                          I had no idea that my form et'all wasn't available to ya'll - crapp - now I see why you said "guess".

                          Does this zip include the form nd all the files necessary? I tried to match the extension you had in your example so I hope so. I just trying to give you the smidgeon of the files without the umpteen thousands of records.

                          I looked and tried several things based on your example - but no luck.

                          george
                          Last edited by czar_g; 06-02-2006, 03:25 PM.

                          Comment


                            #14
                            Originally posted by czar_g
                            I'm about to go postal - It's THIS close...

                            I zpped the files I had in the test directory that I'm working with.
                            Sorry, but can I do something in order to make sure I'm givin all that is required?
                            I had no idea that my form et'all wasn't available to ya'll - crapp - now I see why you said "guess".

                            Does this zip include the form nd all the files necessary? I tried to match the extension you had in your example so I hope so. I just trying to give you the smidgeon of the files without the umpteen thousands of records.

                            I looked and tried several things based on your example - but no luck.

                            george
                            The files all seem to be there, I'll take a look.

                            Ok we have at least two issues.

                            Once you enter or change a field rule it affects data entry from that point forward, changes and new records. If you want the field rule to be retroactively applied you must edit the field rules, save the changes, then use the Rules menu, Re-Evaluate Rules (bottom of the list). This will apply the new rules to existing records.

                            On to point two. You actually have 4 possible combinations of am and pm that we are trying to accomodate with a single if().

                            hrin am hrout pm
                            hrin am hrout am
                            hrin pm hrout pm
                            hrin pm hrout am
                            I'll have to rethink this.
                            Last edited by Stan Mathews; 04-27-2006, 10:12 AM.
                            There can be only one.

                            Comment


                              #15
                              Code:
                              if(round((TOSECONDS(Inv_Test->Hrout)-TOSECONDS(Inv_Test->Hrin))/3600,2)>=0,round((TOSECONDS(Inv_Test->Hrout)-TOSECONDS(Inv_Test->Hrin))/3600,2),round((TOSECONDS(Inv_Test->Hrout)-TOSECONDS(Inv_Test->Hrin)+toseconds("24:00"))/3600,2))
                              Last edited by AaronBBrown; 06-06-2006, 05:14 PM.
                              :) Romy

                              Comment

                              Working...
                              X