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

How to choose which formula to evaluate/compute

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

    How to choose which formula to evaluate/compute

    I am having problems to do some calculations on a certain formula.Here is the fist scenario:
    Price= 2500, Discount=10+1 (to be supplied by user), the discounted price is (2500*10)/11= 2,272.7272
    Here is another scenario:
    Price=2500, Discount = -5% (again to be supplied by the user), the discounted price is 2500-(2500*.05) = 2375.
    Another case is Price=2,500, Discount =+7%, 2500+(2500*.07) =2,675

    My problem is how to evaluate the formula based on the supplied discount by the user(user can enter 12+1,-7%,-10% or 10+2,+8% etc, How will I determine on my app so that I can implement either the first or second formula or 3rd on the 3 scenarios?Thanks!

    #2
    Re: How to choose which formula to evaluate/compute

    Get the user to make a choice of which option they work with, say with a dialog box and radio buttons. This makes you look even more professional. you could actually display the result in the dialog before the answer is committed to the record.
    Regards
    Keith Hubert
    Alpha Guild Member
    London.
    KHDB Management Systems
    Skype = keith.hubert


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

    Comment


      #3
      Re: How to choose which formula to evaluate/compute

      I was going to suggest something along the lines of Keith's reply. Why not have a user related default whole value in a drop-down selection box and a user related default decimal value in a drop-down selection box. That way the user has total control over the discount amount to be applied as and when different to their default. Less real-estate on the screen used up and easy to implement and calculate.
      BTW - I do not understand the +N aspect of your requirement.

      Paul

      Comment


        #4
        Re: How to choose which formula to evaluate/compute

        Jet, would I be correct in assuming a sometimes used trading method, based on discount plus?
        If so , then this is applied differently eg. 30 + 5 is not 35% but an additional 5 percent on the discounted price
        100.00 less 30 + 5 results in, less 30% first = 70.00 then less another 5% = 66.50 -- Not 65.00

        So it cant be done smoothly with buttons. One would display the base discount (gotten from elsewhere, maybe the customer table) and user enter a field with an additional negotiated percentage. I have clients that use that in my software as a standard option.
        Sometimes the base discount shows on each line item and an overall small extra percent over the whole invoice.

        Customer supplies a large store, who negotiate for a large special order often to be able to offer their VAR sale profitably.
        Last edited by Ray in Capetown; 01-27-2013, 03:39 AM.

        Comment


          #5
          Re: How to choose which formula to evaluate/compute

          Ahhh...

          Comment


            #6
            Re: How to choose which formula to evaluate/compute

            One thing that end users like in an application is that they want speed, i suggested it before to pick the mouse and click something so that the formula they want will be executed, they showed me an app made in foxpro 2.6 for DOS, and they said, can you do something like these?(they showed me the app and they just typed 12+1 and the result is computed) and I said to myself, the DOS app is really better than what I am suggesting, no mouse clicks and the result is displayed.

            Ray: this is how the end users compute: 30 + 5, If a customer buys 30 boxes of milk, they will give away 5, if the price is 100, then the price is 100*30/5= 600, or they can give something like these, 100 less 5% which is 100-(100*.05)= 95.00.

            Comment


              #7
              Re: How to choose which formula to evaluate/compute

              Edit
              Last edited by JetLi; 01-27-2013, 05:23 AM.

              Comment


                #8
                Re: How to choose which formula to evaluate/compute

                Then I got it wrong - thats Quantity/price

                Comment


                  #9
                  Re: How to choose which formula to evaluate/compute

                  Well, this should not be too difficult. If you have a table with one text field and one calculated field, then you can present the text field on whatever way you want. Either a dialog box or in a form, does not matter. In the calculated field you make use of the IF statement like this:

                  if user enters "30+5" in the textfield then compute x*y/5 in the calculated field
                  if user enters "10" in the textfield then do x*.90 in the calculated field

                  If you want the input of the discount to be watertight, you can make a table with allowed discount models and then make your textfield in the table above a lookup to the discount table.

                  Comment


                    #10
                    Re: How to choose which formula to evaluate/compute

                    You might want to look at entering a formula - this post http://msgboard.alphasoftware.com/al...luate_template

                    Comment


                      #11
                      Re: How to choose which formula to evaluate/compute

                      I think you are indicating QUANTITY PRICE BREAKS (http://www.mightymerchant.com/home/m...ce_breaks.html) or more complex than that?

                      Comment


                        #12
                        Re: How to choose which formula to evaluate/compute

                        Jet, the solution for you and your customer is to somehow agree on the specific ways in which the discount will be entered in your text box.

                        Parsing raw text is tedious but it can be done. However, if you permit your user to enter anything they want whenever they want Alpha will not be able to "translate" what they've entered.

                        Has there been a discussion with the client in which they've agreed to enter the desired discount in specific ways? And for each do you understand how they want it to be handled?

                        If so how about providing a list here, with an explanation of the desired result (and calculation).

                        -- tom

                        Comment


                          #13
                          Re: How to choose which formula to evaluate/compute

                          I thought of doing it the hard way, extract the first Character of the input by the end user, determine if it is a plus or minus, make a case statement to determine it.I will post on another thread on how to extract the characters before a certain character.

                          Edit:I managed to do it but it requires some more validations.Here is the code
                          dim shared to_display as C
                          dim shared rslt as N
                          dim shared extrct as C
                          Dim we as C
                          Dim allstr as C
                          Dim price as N
                          dim astr as C
                          dim fp as N
                          Dim rslt2 as N
                          dim rslt as N
                          price=ui_get_text("Discount","Enter an expression.",stored)

                          to_display = ui_get_text("Discount","Enter an expression.",stored)
                          allstr = to_display
                          we=substr(to_display,1,4)
                          if we<> "" then

                          we=substr(we,1,1)
                          extrct=substr(to_display,1,1)
                          if extrct="+"
                          rslt2=price*(val(to_display)/100)
                          rslt.value=price+rslt2
                          ui_msg_box("",rslt,UI_OK)
                          end
                          end if

                          if extrct="-" then
                          rslt2=price*(val(to_display)/100)
                          rslt.Value=price+rslt2
                          ui_msg_box("",rslt,UI_OK)
                          end
                          end if

                          if extrct<>"-" .AND. extrct<>"+" then
                          if val(we)>=1 then
                          fp=atc("+",to_display)
                          astr=substr(to_display,fp+1,3)
                          rslt.Value=Round(price*val(to_display)/eval(to_display),4)
                          ui_msg_box("",rslt,UI_OK)
                          end if
                          end if
                          end if

                          Can we please modify this more so that it will be more robust. Thanks!
                          Last edited by JetLi; 01-27-2013, 07:06 PM.

                          Comment


                            #14
                            Re: How to choose which formula to evaluate/compute

                            Jet, you're on the right track, but until you get agreement with the end user on the specifics there's no point in continuing.

                            Would be worthwhile asking if they'll share the foxpro code. It can be readily adapted to Alpha xbasic.

                            Comment


                              #15
                              Re: How to choose which formula to evaluate/compute

                              I will try to get that code and post it here if they will share it.

                              Comment

                              Working...
                              X