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

X-Basic....Help

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

    X-Basic....Help

    Problem: Payroll application, I have a data entry form tied to a set. Top level of set is "Hours", under that is "Employee". In "Employee" is a field for "Wage Attachment", Field12. On data entry form is a field that calculates a specified percentage of the amount in Field12 to be deducted each pay period. This works fine...BUT when I try to subtract the pay period amount from the amount in field 12, I can't get it to work. I tried using action
    scripting, converting it to xbasic, as shown below, without success.
    DeductAmount:N = :Hours:Field72.value
    TotalDeduct:N = :Employee_Data:Field12.value
    var->NewTotal = var->totaldeduct-var->deductamount
    :Employee_Data:Field12.value = var->NewTotal

    What am I doing wrong??

    #2
    RE: X-Basic....Help

    "On data entry form is a field that calculates a specified percentage of the amount in Field12 to be deducted each pay period. " - What is the object name of this field on the form? (check it's properties)

    Once this is known the calculation should be (on the onchange event for field12?):

    dim global diff as n
    var->diff = field12.value-objectnameofpayperiodamt.value
    end

    I think.
    There can be only one.

    Comment


      #3
      RE: X-Basic....Help

      Howard,

      Understanding the problem is the key to the answer.

      Describe the specifics of each data table field involved, including tablename, fieldname, type and meaning.

      Describe the specifics of each display calc field on your form, including it's objectname, type and meaning.

      Then explain which subtraction you are trying to achieve.

      This is necessary because the xbasic technique for referencing fields in your tables is very different than the technique for referencing values displayed in objects on your form.

      -- tom

      Comment


        #4
        RE: X-Basic....Help

        Stan, the pay period amount on the data entry form is a calculated field. The object name is Field72 but when I type your suggested code in the interactive window, I get "Field72 not found". I tried changing that to the name of the calc (calc->wageattach) which didn't work either. Thanks for the suggestion. I will keep plugging away until maybe I learn something.
        Howard

        Comment


          #5
          RE: X-Basic....Help

          Tom, Here are the specifics:
          Object name of the field on the data entry form is Field72 and in the field is "calc->wageattach"
          Calculation is: If (calc->reggrosstotal=0,0,IF(employee->taxattach>0,employee->taxattpercent*calc->reggrosstotal/100,0))
          EMPLOYEE TABLE:
          Object name in employee form is Field12 (type in) and holds the total amount owed by the employee. The field name is Employee->taxattach
          Field22 holds a whole number percentage of the amount to be subtracted from gross pay each pay period.
          Purpose: Each pay period a user defined percentage of gross pay is deducted from the employee's paycheck. This part works fine. The problem came up when I tried to use this calculated value and subtract it from the total amount that is in the employee database, so the program will stop deducting when the total reaches zero. The client normally does this manually by keeping track of the year to date deduction, then removes the total amount from the employee's record when the wage attachment is satisfied.
          Thank you for taking the time to respond to my dilemma.
          Howard

          Comment


            #6
            RE: X-Basic....Help

            Howard,

            So, let's see if I got it right:

            1) If Employee->taxattach >0 you want to subtract calc->wageattach, unless calc->wageattach is greater than Employee->taxattach. In this latter case you would adjust Employee->taxattach to zero by adjusting the payment amount by subtracting employee->Taxattach

            2) If employee->taxattach = 0 then you do not want to adjust employee->taxattach regardless of the amount in the calc->wageattach.

            Assuming I have it reasonably correct, now let's talk context:

            Is this an adjustment you want to occur automatically? If so, under what circumstances? While entering a new record? While changing an existing record? I foresee difficulties if this happens each time the record is changed. Perhaps you need another field to flag whether an adjustment has already occurred for this particular record. Even so, it's going to get complex, since a changed record might necessitate a recalc and further adjustments. This will have to be thought through very carefully, there are lots of ways this can go wrong.

            Consider what happens if the adjustment is implemented to be triggered each time the record is saved.

            At first save the adjustment occurs fine.

            Then the user discovers an error and goes back and changes some item in the record. How do you implement an adjustment to the adjustment? You'll have to keep track of the amount of the last adjustment it seems to me. If the new adjustment is different, then you adjust by the difference only, storing the new total adjustment for the second set of changes when the user discovers that the original record was right after all. This means plus and minus adjustments are possible and must be allowed for.

            Having said all this, assuming the form is in change mode already the following will modify the value of the TaxAttach field in the Employee table:

            Employee->TaxAttach = Employee->TaxAttach - Calc->wageattach

            As indicated above this type of expression will cause TaxAttach to become negative if the WageAttach value is greater than TaxAttach.

            -- tom

            Comment


              #7
              RE: X-Basic....Help

              I see what you mean. I will probably leave it up to the user to check the balance manually instad of banging my head against the wall any more.
              Actually, to state the initial formula, If regulargross pay is zero (as it is for some employees in this particular business, as it is a seasonal business), I don't go any further. If gross pay is greater than zero, then the amount of taxattach in the employee table is multiplied by the percentage in the employee table and deducted from the paycheck. This will probably deduct slightly more than necessary at the final deduction but then it would stop deducting because the total amount to deduct has gone to zero or less. I see I need

              Comment


                #8
                RE: X-Basic....Help

                Howard - you might try this.

                Assuming that at some point in your program, that the deduction balance owed, gross pay this check, and the percentage to use are all known, then use these two lines
                for the calculation, using your own variables.
                ------------------------------------------------------------
                amount_to_deduct = min(amount_owed,(gross_pay * deduct %)
                amount_owed = amount_owed - amount_to_deduct
                ------------------------------------------------------------
                Amount_to_deduct will be the lesser of the calculated amount_to_deduct or the current balance of the deduction. It will be zero if there is no balance owed, and will never be greater then the gross pay, nor the amount_owed.

                You do not need to check if the variables are zero, since
                anything times zero will be zero.

                Note that this should be done AFTER any federal/state tax deductions are subtracted from the current gross.

                Lowell

                Comment


                  #9
                  RE: X-Basic....Help

                  Thanks for your reply Lowell. I understand your response and I already have the first part programmed BUT, it's the second part that is the trouble. As Tom Cone Jr. pointed out, it's what triggers the second calculation that's the problem. If the user edits an entry, and the subtraction gets triggered a second time, the outstanding balance will be reduced erroneously. I have thought of triggering the calculation on the form field that contains the actual deduction but am having trouble with xbasic and action scripting commands, getting the proper syntax.
                  Howard

                  Comment


                    #10
                    RE: X-Basic....Help

                    This sounds strangely familiar? I'm in a rush and didn't read
                    all of this very well but have you tried using an extra field
                    with a checkbox value to hold off recalculation? Something
                    like:

                    Allow Recalculation(Y/N):

                    Comment


                      #11
                      RE: X-Basic....Help

                      Howard, I guess I was assuming that this was a batch job, now I think you are talking about working from a form, one
                      entry at a time.

                      Another aproach is to create work files for the
                      calculations, print edit lists, then do an xbasic post from the work files to the real files. This allows changes to the work files, up to and including zapping them and starting over.

                      I personaly NEVER update anything but static data in real time, always created transaction records and updated dynamic fields from an edited work file.

                      Any corrections to the original amount would be made in
                      a second posting, preserving an audit trial of the changes.

                      Lowell

                      Comment

                      Working...
                      X