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

.Or. What?

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

    .Or. What?

    Sorry about the corny title. Any thoughts on the following...?

    I am trying to construct an effecient filter expression which will have multiple .or. operators as in:

    Accnt_no="10124" .or. Accnt_no="10125"

    Which is fine so far, but the number of OR operatiors is going to be several hundred. It actually works fine in some tests of 150 OR's and is reasonably fast, but I start to run in to maximum charactor allowed for the places I would set my filter, DBF.Filter=, for instance.

    I also tried inlist2() function. That works for my 150 test also, but is extremely slow.

    Add to this my record set is near 350,000, so I've got a problem.

    The two things I have not tried (and don't know if they will work) are

    1 - Some Array method
    2 - possibly running a query on the table prior to view. I don't think that will work in the web environment.
    Steve Wood
    See my profile on IADN


    #2
    Re: .Or. What?

    This is one of the things that I missed in DBFs but is easy in SQL - the in() function takes care of that :)

    Comment


      #3
      Re: .Or. What?

      I don't know whether the A5_COMBINE_FILTERS() functions will work. Worth a try.

      Comment


        #4
        Re: .Or. What?

        Hi Steve,
        I cannot help you out with this, because I have been faced with the same issue.

        So I'm hoping that if a suitable outcome is found that you would post it.

        Thanks,
        mike
        Mike Reed
        Phoenix, AZ

        Comment


          #5
          Re: .Or. What?

          Originally posted by Steve Wood View Post
          Sorry about the corny title. Any thoughts on the following...?

          I am trying to construct an effecient filter expression which will have multiple .or. operators as in:

          Accnt_no="10124" .or. Accnt_no="10125"
          Try this instead
          wordat(ut(Accnt_no),"10124,10125",",")>0
          If the filter expression is still too long, try
          compare_string="10124,10125"
          wordat(ut(Accnt_no),compare_string,",")>0

          I'll also add that INLIST2() is a wrapper function that does a similar result, but is extremely inefficient. WORDAT() is a native function that runs extremely fast.

          wordat(ut(Accnt_no),"10124,10125",",")>0 ' .000316952548 seconds
          inlist2(Accnt_no,"10124,10125") ' .00189107413 seconds

          Inlist2() is 6 times slower. How do I know? Gee, perhaps there is a utility that could accurately measure code execution times :) of code fragments?

          Maybe the CSDA Code Utility ?
          Last edited by csda1; 06-26-2008, 04:07 PM.
          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


            #6
            Re: .Or. What?

            Steve, I had a couple thoughts. First, if the filter is a couple hundred or so entries long, then you must have them in a table somewhere. Probably not being selected one-by-one by hand. Second, after you get those records, then you must be plannig to do something with them.

            So, this may be a good place to create a temporary table. If both tables are in account number order, or are indexed on account number, you could loop through the selected accounts and copy the records (or maybe just a few needed fields) to the temp table.

            Then base your actions on the temp table.

            Pat
            Pat Bremkamp
            MindKicks Consulting

            Comment


              #7
              Re: .Or. What?

              Originally posted by Steve Wood View Post
              Sorry about the corny title. Any thoughts on the following...?
              Yes, you should be.... :D

              Originally posted by Steve Wood View Post
              Add to this my record set is near 350,000, so I've got a problem.

              The two things I have not tried (and don't know if they will work) are

              1 - Some Array method
              2 - possibly running a query on the table prior to view. I don't think that will work in the web environment.
              3. Build a table with a record with each value in it and a set that links to the original table... Then you don't have many limitations....
              Al Buchholz
              Bookwood Systems, LTD
              Weekly QReportBuilder Webinars Thursday 1 pm CST

              Occam's Razor - KISS
              Normalize till it hurts - De-normalize till it works.
              Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
              When we triage a problem it is much easier to read sample systems than to read a mind.
              "Make it as simple as possible, but not simpler."
              Albert Einstein

              http://www.iadn.com/images/media/iadn_member.png

              Comment


                #8
                Re: .Or. What?

                Ira "Gee, perhaps there is a utility...". I've never thought of you as a 'utility', but yes you are good at measuring this sort of stuff:). OK, OK, I'll break out the CSDA Code Utility. Have to admit, I am getting to the point where I need that more often as my client's databases and expectations are growing. I'll test all of those suggestions and report back. The client has agreed to limit the filter to 50 or so Accounts, which will fall within the limit I found using DBF.filter= on the A5W page.

                FYI - As part of this I tested session variable length. Appears to be practically unlimited in size. It must have some limit, but I threw 30,000 characters at it and it retained the value.

                Pat - yes the filter parameters are in a database. The structure is such that Accnt#1000 controls all of these other Accounts 1002,1003,1006, etc. The list of controlled accounts can change at any time, so maybe they change the list to 1002,1999,1006, and then the filter still has to work right after that.

                Where I have the luxury of running a script, I certainly don't use this filter method, I use a query and fetch like I should. But I want to display all of the "controlled accounts" in a Grid, and that requires a filter expression.

                I'm not an SQL expert, but it sounds like what I want is to select the records I want and bring back a Result Set. In A5, that would be similar to what you propose, bring the records over to a temp table, or perhaps summarize them.
                Steve Wood
                See my profile on IADN

                Comment


                  #9
                  Re: .Or. What?

                  Originally posted by Steve Wood View Post
                  Pat - yes the filter parameters are in a database. The structure is such that Accnt#1000 controls all of these other Accounts 1002,1003,1006, etc. The list of controlled accounts can change at any time, so maybe they change the list to 1002,1999,1006, and then the filter still has to work right after that.
                  Steve,
                  One way to read this is that you are looking for all accounts in the 1000 range.
                  Code:
                  If not then
                       ignore the rest of this
                  Else 
                       Try left(Accnt_no,1) = "1"
                  End if
                  Tim Kiebert
                  Eagle Creek Citrus
                  A complex system that does not work is invariably found to have evolved from a simpler system that worked just fine.

                  Comment


                    #10
                    Re: .Or. What?

                    Just another thought...

                    What about a "filter" field in the table. Reset it it to false and then just run through the table with the filter parameters setting the field to true. Now when you need a the filter expression you just need to check one field for one value. Another benefit would be to set a saved variable (boolean) that would indicate if there have been new account codes added. If not, your table would already have the right values set and save the time and effort of resetting the field values. Depends on how often your list changes. If not often, then this might be a very plausible solution.

                    Comment


                      #11
                      Re: .Or. What?

                      Would be interesting to see what happens when that session variable is overriden with a 30,000 character url parameter!

                      Bill.

                      Comment


                        #12
                        Re: .Or. What?

                        Just tried Ira's approach. I was originally using:

                        parentform.BaseQueryRun("selfpay=.f. .and. inlist2(systemid,var->gpc2)","fullname")

                        I tried:
                        parentform.BaseQueryRun("selfpay=.f. .and. wordat(ut(systemid),var->gpc2,',')>0","fullname")

                        I prepopulated var->gpc2 with 190 words and ran against a table with about 17,000 records

                        went from about 3 seconds to about 1/5 second!!! Major improvement.
                        Cole Custom Programming - Terrell, Texas
                        972 524 8714
                        [email protected]

                        ____________________
                        "A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw

                        Comment


                          #13
                          Re: .Or. What?

                          Originally posted by martinwcole View Post
                          Just tried Ira's approach. I was originally using:

                          parentform.BaseQueryRun("selfpay=.f. .and. inlist2(systemid,var->gpc2)","fullname")

                          I tried:
                          parentform.BaseQueryRun("selfpay=.f. .and. wordat(ut(systemid),var->gpc2,',')>0","fullname")

                          I prepopulated var->gpc2 with 190 words and ran against a table with about 17,000 records

                          went from about 3 seconds to about 1/5 second!!! Major improvement.
                          Feel free to send me a check for all the time you save! :D

                          When ever you have a query/filter expression, efficiency is always #1 unless processing a trivial number of records. If systemid is already trimmed you don't need to use UT(). Even if it isn't, TRIM() might be a slight bit faster, though probably not measureable. WordAt() is case-insensitive, WordAtC() is case-sensitive version
                          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


                            #14
                            Re: .Or. What?

                            Hey!!!!! I done already bought the supreme version of csda utility!! (Just needed you to use it for me)
                            Cole Custom Programming - Terrell, Texas
                            972 524 8714
                            [email protected]

                            ____________________
                            "A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw

                            Comment


                              #15
                              Re: .Or. What?

                              Hi Martin,

                              Originally posted by martinwcole View Post
                              (Just needed you to use it for me)
                              And that's what the check is for, TECH SUPPORT! :D

                              Actually though, it amazes me how many people run with critical sections of code that could be enhanced by speedups. If that code took 10 minutes to run the query originally and now runs in 1 minute, that's a 9 minute savings each time it's run. Multiply that by the frequency it is run at, and it makes a big cost savings.

                              It's a service I offer to users and other consultants, but few seem to take advantage of it.:(

                              The right tweak can change an application from a dog to a cheetah. It seems like the typical range of speed increase ranges from 30% faster for a very well written & conceived piece of code to an amazing 20000% (In other words 200x faster) for some algorithms. 50x is not uncommon for typical code. If your numbers are accurate, you had a 1500% increase (15x), which is not bad.

                              Sometimes it's code, sometimes it's algorithms, sometimes it's methods (e.g. passing a large blob/string to a function can be high overhead, but pass a pointer to the blob/string and it's virtually instantaneous)
                              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

                              Working...
                              X