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 many Nested (IF's) are allowed

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

    How many Nested (IF's) are allowed

    Anyone know if there is a limit to the number of nested (IF) statements allowed in a single function command.

    I know Excel 2003 has a limit to 7 nested (IF) statements, that includes the .F. result, just wondering if Alpha has such a limit.

    if(class=4, "Senior", if(class=3, "Junior", if(class=2, "Sophomore", "Freshman")))............)))))))))) ?

    #2
    Re: How many Nested (IF's) are allowed

    You might consider using the Case() function. It's simpler.

    Edit: anticipating someone pointing out the documentation states or at least suggests a limit of 16 Case statements, this shows otherwise:

    Code:
    case(.f.,"a",.f.,"b",.f.,"c",.f.,"d",.f.,"e",.f.,"f",.f.,"g",.f.,"h",.f.,"i",.f.,"j",.f.,"k",.f.,"l",.f.,"m",.f.,"n",.f.,"o",.f.,"p",.f.,"q",.f.,"r",.f.,"s",.f.,"t",.f.,"u",.f.,"v",.f.,"w",.f.,"x",.f.,"y",.t.,"z")
    Last edited by Steve Workings; 02-01-2010, 09:02 PM.
    -Steve
    sigpic

    Comment


      #3
      Re: How many Nested (IF's) are allowed

      Originally posted by Chuck Bytes View Post
      Anyone know if there is a limit to the number of nested (IF) statements allowed in a single function command.

      I know Excel 2003 has a limit to 7 nested (IF) statements, that includes the .F. result, just wondering if Alpha has such a limit.

      if(class=4, "Senior", if(class=3, "Junior", if(class=2, "Sophomore", "Freshman")))............)))))))))) ?
      As far as I know, Alpha has no practical limit, as I believe it just uses available stack space for memory. The case statement may have a limit, only because it uses one function, rather than stacking the usages, however, I bet it's beyond most to exceed.

      Expression length in database fields (*.dbf) will be limited to 255 characters, and may be limited to 1024 in many places. XBasic expressions, have no real length limitation.
      Regards,

      Ira J. Perlow
      Computer Systems Design


      CSDA A5 Products
      New - Free CSDA DiagInfo - v1.39, 30 Apr 2013
      CSDA Barcode Functions

      CSDA Code Utility
      CSDA Screen Capture


      Comment


        #4
        Re: How many Nested (IF's) are allowed

        Originally posted by csda1 View Post
        XBasic expressions, have no real length limitation.
        So what is this that the documentation on specifications is relating (attached)?
        Mike W
        __________________________
        "I rebel in at least small things to express to the world that I have not completely surrendered"

        Comment


          #5
          Re: How many Nested (IF's) are allowed

          Mike,
          The expression builder may have a limit but by using variables or UDFs in the expression builder the limit does not really affect the amount of characters you can use as a variable/UDF is basically unlimited for length I understand.....good thing too as otherwise I couldn't use the huge filter lists that I need for various projects!!
          Mike
          __________________________________________
          It is only when we forget all our learning that we begin to know.
          It's not what you look at that matters, it's what you see.
          Henry David Thoreau
          __________________________________________



          Comment


            #6
            Re: How many Nested (IF's) are allowed

            Hi Mike,

            Originally posted by Mike Wilson View Post
            So what is this that the documentation on specifications is relating (attached)?
            This is related to places in Alpha Five (e.g. fieldrule expressions) that have a limit for the expression (1024). Some of the limits you may find are
            • Expression and filters for Index definitions have a limit as well due to the DBF format, something like 212 characters for the index expression, probably 512 for the filter, although the input may allow more than that in text.
            • Action script definitions (which are just code generators for XBasic and Xdalog) will allow whatever they have been designed to allow
            • Inline XBasic for Action Scripts may have a maximum length of 16 lines, but that may have been changed, although there is no inherent limitation in any XDialog or Ation Script.
            • XDialog and maybe someplaces in XBasic that use other Active X controls (e.g. Listview objects), they may have limits placed on it by the Active X control.
            • Calculated fields on layouts have a limit of 1024 characters, and there may be similar limits on expressions used elsewhere in a layout's definitions
            • Character and Blob variables have no limits in length to their contents, and the size of their contents does not affect the size of an expression they are used in (unless you are embedding their contents into the expression, typically as a constant)
            • The code editor has a limit of about 13000 lines for any single piece of code, but that might be a length limitation in bytes, thus there is no practical limit on expressions used in code.
            • The data dictionaries themselves have a file maximum size of 2 Gigabytes for any file.
            Mike C,
            Originally posted by MikeC View Post
            Mike,
            The expression builder may have a limit but by using variables or UDFs in the expression builder the limit does not really affect the amount of characters you can use as a variable/UDF is basically unlimited for length I understand.....good thing too as otherwise I couldn't use the huge filter lists that I need for various projects!!
            When you use a UDF (or actually any "slower" function, UDF or built-in) in an index's filter or order expression, it pays a real penalty in speed. This is only really seen when rebuilding an index or creating a query. I'd use it as a last resort if you don't have space in the expression. Large variables don't slow things down except as in which each variable is operated on by UDF's or built-in function.
            Regards,

            Ira J. Perlow
            Computer Systems Design


            CSDA A5 Products
            New - Free CSDA DiagInfo - v1.39, 30 Apr 2013
            CSDA Barcode Functions

            CSDA Code Utility
            CSDA Screen Capture


            Comment


              #7
              Re: How many Nested (IF's) are allowed

              Ira,
              I normally use variables for long filters, but someone once suggested using a function for my purpose....and it did work, but used a variable so I lucked out and chose correctly! I never realized how much I would have to use speed recommendations (mostly yours) in my work but it is a constant battle to keep my projects running fast enough to be user friendly now.

              Thanks again Ira.
              Mike
              __________________________________________
              It is only when we forget all our learning that we begin to know.
              It's not what you look at that matters, it's what you see.
              Henry David Thoreau
              __________________________________________



              Comment


                #8
                Re: How many Nested (IF's) are allowed

                Hi Mike,

                Originally posted by MikeC View Post
                Ira,
                I normally use variables for long filters, but someone once suggested using a function for my purpose....and it did work, but used a variable so I lucked out and chose correctly! I never realized how much I would have to use speed recommendations (mostly yours) in my work but it is a constant battle to keep my projects running fast enough to be user friendly now.

                Thanks again Ira.
                You're welcome.

                My number 1 guide is that data will grow to such a point as to make any code's speed unusable! So I always code for speed by choosing algorithms & methods to process, and then tailor which A5 functions/methods I use to be the "right" ones.

                I'm amazed that Google is capable of indexing the Internet without it taking hours to process! (of the estimated 5 billion terabytes on the internet)
                Regards,

                Ira J. Perlow
                Computer Systems Design


                CSDA A5 Products
                New - Free CSDA DiagInfo - v1.39, 30 Apr 2013
                CSDA Barcode Functions

                CSDA Code Utility
                CSDA Screen Capture


                Comment


                  #9
                  Re: How many Nested (IF's) are allowed

                  Well, I tested the limits of the IF statement with 37 incidences and it worked without a flaw.

                  Excellent.

                  I know this is not the most efficient function to use, but for a novice, the IF statement is a life saver until something better is figured out.

                  A5 keeps impressing me. Probably because I am a novice and can put out an application that would rival the competitions that cost thousands upon thousands.

                  Well done fellas.

                  Comment

                  Working...
                  X