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

Using function in a calculation problems

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

  • Using function in a calculation problems

    Hello,
    I'm creating an application that help Fashion designer to calculate data when crating a sloper for the garment, in one of the fields is needed the following calculation,
    Example:
    Bust = 33"
    Underbust = 27"
    A: Cup size = If the underbust is an ODD number add 5", and if the result is even then add 4" in our example the number is 27" so we add 5" the result then is 32".
    New Underbust number is 32"
    B:next: Bust - New UnderBust 33"-32"= 1"
    If the result = 1" the cup size is "A"
    If the result = 2" the cup size is "B"
    If the result = 2" the cup size is "B"
    In our case the Cup Size is "A"
    In excel is very simple:
    A: =IF(ISODD(UnderBust),UnderBust+5",UnderBust+4")
    B: =IF((Bust-UnderBust)=1,"A",IF((Bust-UnderBust)=2,"B","C"))

    In
    Alpha anywhere v 12 the ISODD function is not recognize.
    Can anybody Help me fix this issue?

    Thanks
    Samuel Eskenasy

  • #2
    Re: Using function in a calculation problems

    Use Mod() to determine if it is even or odd.
    Andrew

    Comment


    • #3
      Re: Using function in a calculation problems

      ? mod(int(-1),2)
      = -1
      ? mod(int(2.5),2)
      = 0
      ? mod(int(5),2)
      = 1
      So if mod(int(some_value),2) <> 0 the number ISODD.
      There can be only one.

      Comment


      • #4
        Re: Using function in a calculation problems

        See Stan's solution to this here:

        http://www.alphasoftware.com/alphafo...ght=odd+number

        Edit: Geeze, where else can you get this much help this fast?
        -Steve
        sigpic

        Comment


        • #5
          Re: Using function in a calculation problems

          Thanks for the citation, Steve. Seems the Excel ISODD() operates a bit differently with fractional parts so I tweaked the logic a bit.
          Last edited by Stan Mathews; 04-06-2015, 03:40 PM.
          There can be only one.

          Comment


          • #6
            Re: Using function in a calculation problems

            i see you are in mobile & Browser forum, where is this calculation being done
            in an ux or an updatable grid? if so, then you may want to consider writing the code in javascript. which will not require a callback to the server.
            Last edited by GGandhi; 04-07-2015, 07:51 AM.
            thanks for reading

            gandhi

            version 11 3381 - 4096
            mysql backend
            http://www.alphawebprogramming.blogspot.com
            ggandhi344@gmail.com
            Skype:ggandhi344@gmail.com
            1 914 924 5171

            Comment


            • #7
              Re: Using function in a calculation problems

              Thanks for responding, I'm checking to see if it works.
              Samuel

              Comment


              • #8
                Re: Using function in a calculation problems

                Originally posted by GGandhi View Post
                i see you are in mobile & Browser forum, where is this calculation being done
                in an ux or an updatable grid? if so, then you may want to consider writing the code in javascript. which will not require a callback to the server.
                I add the calculation in a UX field calculation. But I'm really confuse with the mod() function(don't figure out how to place the data).

                Comment


                • #9
                  Re: Using function in a calculation problems

                  IF(ISODD(UnderBust),UnderBust+5",UnderBust+4")

                  would become

                  IF(mod(int(UnderBust),2)>0,UnderBust+5",UnderBust+4")
                  There can be only one.

                  Comment


                  • #10
                    Re: Using function in a calculation problems

                    Originally posted by Stan Mathews View Post
                    IF(ISODD(UnderBust),UnderBust+5",UnderBust+4")

                    would become

                    IF(mod(int(UnderBust),2)>0,UnderBust+5",UnderBust+4")

                    I'd try your suggestion, an error massage "mod" is undefined .

                    Comment


                    • #11
                      Re: Using function in a calculation problems

                      Then you're operating in an environment where xbasic functions aren't allowed. See post #6 about using javascript.

                      Actually the earlier answer was not entirely correct.

                      The expression should not have the " inch representation.


                      IF(mod(int(UnderBust),2)>0,UnderBust+5,UnderBust+4)
                      There can be only one.

                      Comment


                      • #12
                        Re: Using function in a calculation problems

                        Originally posted by Stan Mathews View Post
                        Then you're operating in an environment where xbasic functions aren't allowed. See post #6 about using javascript.

                        Actually the earlier answer was not entirely correct.

                        The expression should not have the " inch representation.


                        IF(mod(int(UnderBust),2)>0,UnderBust+5,UnderBust+4)

                        I make the correction, and stillErrorMsg.PNG

                        Comment


                        • #13
                          Re: Using function in a calculation problems

                          mod is an alpha function, highly doubt that it is available at the browser level.
                          you should be doing this via javascript, otherwise you should do an ajaxcallback to the server where the function is available at the WAS.
                          additionally you need two step process these two should be able to be combined in one javascript call and the size is captured at the end.
                          again you did not answer my original question in post number 6. is this on an ux or updatable grid?
                          thanks for reading

                          gandhi

                          version 11 3381 - 4096
                          mysql backend
                          http://www.alphawebprogramming.blogspot.com
                          ggandhi344@gmail.com
                          Skype:ggandhi344@gmail.com
                          1 914 924 5171

                          Comment


                          • #14
                            Re: Using function in a calculation problems

                            I add the calculation in a UX field calculation. #8

                            Comment


                            • #15
                              Re: Using function in a calculation problems

                              okay this is what you do
                              say if you have three fields
                              bust a number, under_breast a number and cup a character fields, then in the under_breast onChange event define an inline javascript and copy the following.
                              Code:
                              var underBreast = {dialog.object}.getValue('UNDER_BREAST’);
                              var onBust = {dialog.object}.getValue(‘BUST’);
                              var newUnderBreast = null;
                              if (underBreast%2 == 0) {
                                 newUnderBreast = parseInt(underBreast) + 4;
                              } else {
                                newUnderBreast = parseInt(underBreast) + 5;
                              }
                              var cupSize = null;
                              if (onBust - newUnderBreast == 1) {
                                   cupSize = 'A';
                              }
                              else if (onBust - newUnderBreast == 2) {
                                  cupSize = 'B';
                              }
                              else  {
                                 cupSize = ‘C’;
                              }
                              
                              {dialog.object}.setValue(‘CUP’, cupSize);
                              and you can change the condition of C as you please.

                              i am not going to be at my work computer till saturday any fine tuning will take time for me to do.
                              let us know how it goes.
                              Last edited by GGandhi; 04-09-2015, 07:14 AM.
                              thanks for reading

                              gandhi

                              version 11 3381 - 4096
                              mysql backend
                              http://www.alphawebprogramming.blogspot.com
                              ggandhi344@gmail.com
                              Skype:ggandhi344@gmail.com
                              1 914 924 5171

                              Comment

                              Working...
                              X