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



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

Help with Calculated Field Expression

  • Filter
  • Time
  • Show
Clear All
new posts

  • Help with Calculated Field Expression

    Hi! I'm very new to alpha five and I'm not a programmer at all. The most I've done with formulas is creating basic formulas in excel so please be patient with me :o)

    We are creating a web page that will house executive level performance and merit information. We are being asked to have a tab where we have current salary, merit percentage increase, merit dollar increase and New Salary. So for example:

    Current Salary = 100,000
    Merit % Increase = 10%
    Merit $ Increase = 10,000
    New Salary = 110,000

    Here is the catch. I need to be able to let someone enter a $ amount OR a % and the other needs to automatically calculate. For example, if someone enters the 10,000 in the Merit $ increase field then the Merit % Increase should auto populate. If someone enters the 10% in the Merit % increase then the Merit $ Increase should auto populate. The New Salary can add the Current Salary and the Merit $ Increase amount.

    What we have tried:
    We enter a calculated field expression in the Merit % Increase to say something like - if(Merit$Increase > 0, Merit$Increase + CurrentSalary, 0) and in the Merit $ Increase field we have if(Merit%Increase > 0, ((Merit%Increase - CurrentSalary)/(CurrentSalary)), 0) except it creates a circular reference obviously and doesn't work.

    We also tried using the onclick, onchange, onselect, etc. but we don't know java or xbasic to figure out what kind of wording to use so we keep getting errors. We checked the forums and the videos and still cannot figure this out.

    Oh, we are connecting to a sql table that houses all our data.

    If anyone can help us newbies we'd really appreciate it!!

    Thank you so much!!!!
    Last edited by HRSue; 01-22-2012, 07:00 PM. Reason: added info about connecting to a sql table incase that means anything to someone trying to answer

  • #2
    Re: Help with Calculated Field Expression

    Hi Sue,

    While this is not a definitive answer but just a pointer, have a look at the e.variables in grid events.
    Keith Hubert
    Alpha Guild Member
    KHDB Management Systems
    Skype = keith.hubert

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


    • #3
      Re: Help with Calculated Field Expression


      Here's a thought. Create an additional field of type hidden and make it a calculated field with a formula like

      if( Merit $ Increase > 0, Current Salary + Merit $ Increase, if( Merit % Increase > 0, CurrentSalary * Merit % Increase, 0))

      Then make New Salary = Current Salary + this hidden value.

      Also, if these are going to be used on the web, you should not have spaces in the field names, and avoid special characters that have special meaning like $ and %. Most of us use something like Merit_Dollar_Increase and Merit_Percent_Increase
      Pat Bremkamp
      MindKicks Consulting


      • #4
        Re: Help with Calculated Field Expression

        thank you both! I will look into the e.variable and see if I can manage that.

        Pat - that is a good idea. The only thing is that the person entering the information will want to see what the % is if they add the $ amount and they will want to see the $ amount if they enter the percent. Any thoughts on how to do that without getting a circular reference? I am stuck on the last part of the formula. I want it to allow me to just enter the amount if the other part is false. We did add a flag and that is the InputFlag with an option of Percent or Amount. So basically I need something like:

        if(InputFlag = "Amount" AND TargetAmtNew > 0, TargetAmtNew / USSalaryCurrent, ......) that last part is the part that gives me a problem. I have to put a similar formula in the Percent field.


        Thank you!!


        • #5
          Re: Help with Calculated Field Expression

          I know you're not a programmer, but you could do that w. some simple JavaScript that reads the 10% or the $10,000 from the input field, calcs, and dumps the results into the output field.

          Now do I get that $10,000 merit bonus?
          AlphaBase Solutions, LLC

          [email protected]


          • #6
            Re: Help with Calculated Field Expression

            I knew you would know Peter :o) Now can you give me the wording to use because that is where I'm having the problem lol. I can't figure it out without creating a circular reference. I wish I was receiving that bonus after all this Alpha Five work ;o)


            • #7
              Re: Help with Calculated Field Expression

              If I have time later, I'll write a sample expression for you.
              AlphaBase Solutions, LLC

              [email protected]


              • #8
                Re: Help with Calculated Field Expression

                This is just one approach, not fully tested; seems to do what you are after; probably needs some tweaking:
                It's all happening on the client side

                CurrSal - no expression
                MeritPct - (1)
                MeritAmt - (2)
                TotSal - (3)

                (1)In its onBlur
                var z1={grid.Object}.getValue('G','CURRSAL',{Grid.RowNumber});
                var z2={grid.Object}.getValue('G','MERITPCT',{Grid.RowNumber});

                (2) in its onBlur
                var z1={grid.Object}.getValue('G','CURRSAL',{Grid.RowNumber});
                var z2={grid.Object}.getValue('G','MERITAMT',{Grid.RowNumber});

                (3) Client Side Express
                CurrSal + (CurrSal*MeritPct)/100

                When entering MeritPct enter it as 2.6, 10.8 (not 0.026, 0.108)


                • #9
                  Re: Help with Calculated Field Expression

                  This information helped tremendously Gaby! The only issue is that once I enter the display format I get a NaN error in the cells with the onblur command. Short of removing the formatting (which I would love to have) I don't know what to do now? Any suggestions?


                  • #10
                    Re: Help with Calculated Field Expression

                    That's what the tweaking was about. Try the following:

                    In MeritPct add the following condition:
                    if (z1>0 && z2>0)

                    In MeritAmt add the following condition:
                    if (z1>0 && z2>0)
                    { {grid.Object}.setValue('G','PCTBONUS',{Grid.RowNumber},(z2/z1)*100); }

                    In TotSal refine it as follows:
                    if( PctBonus>0 or AmountBonus>0, BaseSal+(BaseSal*PctBonus)/100, 0)

                    to get rid of NaN
                    and see how it goes.


                    • #11
                      Re: Help with Calculated Field Expression

                      Sue --

                      If you've done any other kind of programming (C, Foxpro, Basic, etc.) picking up xBasic is not that hard once you get over the original mind twist required for any new language. I'm afraid that you have to learn xBasic if you want to create even semi-sophisticated applications with A5. Although Alpha Software doesn't provide us with any kind of reasonable xBasic help beyond the wiki, or even a few tutorials, here's a good starting point: It's a bit old, but still quite valid as a starter.


                      • #12
                        Re: Help with Calculated Field Expression

                        The Wiki does have some useful info on learning Xbasic.
                        Jim Coltz
                        Alpha Custom Database Solutions, LLC
                        [email protected]


                        • #13
                          Re: Help with Calculated Field Expression

                          Some, yes. But have you tried to use this Wiki entry as a newbie without any clue as to the xBasic syntax and capabilities? Maybe it's just me, but I gave up after 15 minutes and started Googling, Binging and Yahooing for better sources. However, now that I have wrapped my brain around it a bit, I find myself constantly translating what I already know from other languages to what I think is in xBasic, and that helps a lot -- I'm not completely in the thick woods anymore. Would've been nice to have some hand-holding documentation to get me started in the right direction, though.


                          • #14
                            Re: Help with Calculated Field Expression

                            I found Dr. Peter Wayne's book very useful when I was starting to learn Xbasic. Although it is written for version 8 it still has lots of great information.
                            Jim Coltz
                            Alpha Custom Database Solutions, LLC
                            [email protected]


                            • #15
                              Re: Help with Calculated Field Expression

                              I have never done any kind of programming at all. The closest I've come to programming is formulas in excel :o)

                              Thank you Gaby!! I will try that in the morning!

                              Thank you everyone else for providing useful resources that I will definitely look into! I was hoping there would be an Alpha Five for dummies!!

                              I will keep you all posted on how this works out.