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

On Grid Filter execute syntax help Please

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

    On Grid Filter execute syntax help Please

    Hi All,

    THIS IS DBF NOT SQL

    I am trying to filter a grid by states. I would like to show records for 40 out of 52 states and can not get syntax right.

    I have tired inlist(), inlist2(), and I have gotten close, but no joy. My issue seems to be in referencing the grid field within the inlist function.

    Can someone offer some assistance or a better method.

    I am doing this in the OnGridExecute event using " e.tmpl.DBF.filter = "

    Thanks for any help,

    Scott

    #2
    Re: On Grid Filter execute syntax help Please

    anyone???

    Comment


      #3
      Re: On Grid Filter execute syntax help Please

      Not sure, but I don't think e.tmpl.DBF.filter understands inlist. It's looking for criteria.

      For whatever States you want to filter on, built a filter list that would follow this format...

      Code:
      e.tmpl.DBF.filter = "Bill_State_Region='MA' .OR. Bill_State_Region='NY'"

      Comment


        #4
        Re: On Grid Filter execute syntax help Please

        i wish I could .. but the filter exceeds the 1023 char limit ... that's why I was trying to use inlist. If this was a SQL backend it would be a breeze. Grrrrr

        Thanks David

        Comment


          #5
          Re: On Grid Filter execute syntax help Please

          Was your "40 out of 52 State" just an example... or do you actually want all States except 12?

          Comment


            #6
            Re: On Grid Filter execute syntax help Please

            Another brute force way to do this is to either change the name of your state field... impractical... or add another field to your table... e.g. ST

            Ensure that ST always gets the same value as your normal state field.

            Using ST in the filter for 40 states is under 500 characters.

            Comment


              #7
              Re: On Grid Filter execute syntax help Please

              I think I remember from the old days of foxpro (dbf) that I was able to break it down into more than one variable and sneak that through. I am not sure of how that will work with alpha however. May be worth a try. perhaps save half of the filter to state_filter_a and half to state_filter_b then use e.tmpl.DBF.filter = state_filter_a and state_filter_b
              Win 10 64 Development, Win 7 64 WAS 11-1, 2, Win 10 64 AA-1,2, MySql, dbForge Studio The Best MySQL GUI Tool IMHO. http://www.devart.com/dbforge/mysql/studio/

              Comment


                #8
                Re: On Grid Filter execute syntax help Please

                Frank, that's worth a try, I tried with one variable and it way exceeded the 1023 limit .. but I will play some more ...

                David, Thanks, I was thinking I might just need to add a logical field or something ..

                I used to like DBF but after using SQL for the past 6 years I am not liking it as much .. :/

                Scott

                Comment


                  #9
                  Re: On Grid Filter execute syntax help Please

                  I tried Franks suggestion... thinking the same thing... that maybe it depends were the limit is... but it gets resolved and is past the limit...

                  Code:
                  dim filter1 as c = "bill_state_region='AL' .or. bill_state_region='AK' .or. bill_state_region='AZ' .or. bill_state_region='AR' .or. bill_state_region='CA' .or. bill_state_region='CO' .or. bill_state_region='CT' .or. bill_state_region='DE' .or. bill_state_region='FL' .or. bill_state_region='GA' .or. bill_state_region='HI' .or. bill_state_region='ID' .or. bill_state_region='IL' .or. bill_state_region='IN' .or. bill_state_region='IA' .or. bill_state_region='KS' .or. bill_state_region='KY' .or. bill_state_region='LA'"
                  
                  dim filter2 as c = " .or. bill_state_region='ME' .or. bill_state_region='MD' .or. bill_state_region='MA' .or. bill_state_region='MI' .or. bill_state_region='MN' .or. bill_state_region='MS' .or. bill_state_region='MO' .or. bill_state_region='MT' .or. bill_state_region='NE' .or. bill_state_region='NV' .or. bill_state_region='NH' .or. bill_state_region='NJ' .or. bill_state_region='NM' .or. bill_state_region='NY' .or. bill_state_region='NC' .or. bill_state_region='ND' .or. bill_state_region='OH' .or. bill_state_region='OK' .or. bill_state_region='OR' .or. bill_state_region='PA' .or. bill_state_region='RI'"
                  
                  e.tmpl.DBF.filter = filter1 + filter2
                  This works and comes out with a length of 524

                  Code:
                  e.tmpl.DBF.filter = "st='AL' .or. st='AK' .or. st='AZ' .or. st='AR' .or. st='CA' .or. st='CO' .or. st='CT' .or. st='DE' .or. st='FL' .or. st='GA' .or. st='HI' .or. st='ID' .or. st='IL' .or. st='IN' .or. st='IA' .or. st='KS' .or. st='KY' .or. st='LA' .or. st='ME' .or. st='MD' .or. st='MA' .or. st='MI' .or. st='MN' .or. st='MS' .or. st='MO' .or. st='MT' .or. st='NE' .or. st='NV' .or. st='NH' .or. st='NJ' .or. st='NM' .or. st='NY' .or. st='NC' .or. st='ND' .or. st='OH' .or. st='OK' .or. st='OR' .or. st='PA' .or. st='RI'"

                  Comment


                    #10
                    Re: On Grid Filter execute syntax help Please

                    David.

                    Thanks for playing with this. The limit is actually 1023 according to the error message I got. I think the 255 limit is within the expression builder itself which was why I was using xbasic.
                    I also need to do the same filter with countries which also can be abbreviated as in your example.

                    I am going to try Franks idea that you tried (e.tmpl.DBF.filter = filter1 + filter2) and break it down some more and see if we can't beat this sucker.

                    Thanks again,

                    Scott

                    Comment


                      #11
                      Re: On Grid Filter execute syntax help Please

                      Oh well .. Breaking it up didn't work .. got the following error:

                      Filter expression is too long. Filter expression must be 1023 characters or less

                      So back to the drawing board.

                      Scott

                      Comment


                        #12
                        Re: On Grid Filter execute syntax help Please

                        I don't think breaking the filter down further will help. It's the end result that gets resolved and is past the limit. I got exactly the same message with several filter vars as with one string.

                        Comment


                          #13
                          Re: On Grid Filter execute syntax help Please

                          Try
                          Code:
                          filter = "at(ut(bill_state_region),\"AL,AK,AZ,AR,CA,CO,CT,DE,FL,GA,HI,ID,IL,IN,IA,KS,KY,LA,ME,MD,MA,MI,MN,MS,MO,MT,NE,NV,NH,NJ,NM,NY,NC,ND,OH,OK,OR,PA,RI,SC,SD,TN,TX,UT,VT,VA,WA,WV,WI,WY\")>0"

                          Another way, if the data in the list would still cause the 1023 char limit to be exceeded, could be to create a UDF that contained the list and returned a true or false. I suppose the UDF would need to be stored in the AEX or in the new Xbasic Function Library.
                          Last edited by Tim Kiebert; 01-12-2015, 10:41 PM.
                          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


                            #14
                            Re: On Grid Filter execute syntax help Please

                            Could you create a tempory table of the States you want and then do a IN query? Such as:

                            Select * from YourTable where st in (select state_code from tempStates)

                            Comment


                              #15
                              Re: On Grid Filter execute syntax help Please

                              Tim, a UDF might work if it will fire in the filter. Thanks for the idea.

                              Kevin, thanks, just so you know we are talking DBF here .. I wish I could use a select statement :/

                              Scott

                              Comment

                              Working...
                              X