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

Making a filter dynamically

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

    Making a filter dynamically

    I'm trying to build a filter dynamically from other variables and values. The code I've been working with is below. The filter expression if expressly written is between the %c% delineators. I've tried multiple combinations including a host of variations with eval() and evaluate_template() and I just can't get to the endpoint. I'm actually not certain it's doable. If anyone know the solution, I'd appreciate having it. Thank you.

    Code:
    dim vfilter_p1 as C
    dim vseq_no as C="1"
    dim vproj_no as C="PRJ.00833"
    dim vfilter_var_name as C
    dim vfilter_val as C
    dim vproj_name as C
    
    <<%c%
    vfilter_p1="proj_id="+quote(vproj_no)
    %c%
    
    vfilter_var_name="vfilter_p"+vseq_no
    vfilter_val="proj_id"+"="+quote(vproj_no)
    
    '=========  WHAT TO DO HERE TO MAKE THE FILTER FROM PARTS ==================
    
    vtemp=vfilter_var_name+"="+vfilter_val
    msgbox(vtemp)
    
    eval(vtemp)
    msgbox("21",vtemp+crlf()+vfilter_p1)
    
    '===========================================================================
    
    'APPLY THE FILTER
    vproj_name=lookup("projects",vfilter_p1,"proj_name")
    msgbox("27",vproj_name)
    Mike W
    __________________________
    "I rebel in at least small things to express to the world that I have not completely surrendered"

    #2
    I figured it out.

    Code:
    dim vseq_no as C="1"
    dim vproj_id as C="PRJ.00833"
    dim vproj_name as C
    
    <<%c%
    WHAT THE FILTER SHOULD LOOK LIKE
    vfilter_p1="proj_id="+quote(vproj_id)
    %c%
    
    'BUILD THE FILTER VARIABLE
    evaluate_template("dim vfilter_p"+vseq_no+" as C="+chr(34)+"proj_id="+chr(34)+chr(43)+"quote(vproj_id)")
    msgbox("Line 20",vfilter_p1)
    
    'APPLY THE FILTER
    vproj_name=lookup("projects",vfilter_p1,"proj_name")
    msgbox("Line 24",vproj_name)
    Mike W
    __________________________
    "I rebel in at least small things to express to the world that I have not completely surrendered"

    Comment


      #3
      I figured it out.

      Code:
      dim vseq_no as C="1"
      dim vproj_id as C="PRJ.00833"
      dim vproj_name as C
      
      <<%c%
      WHAT THE FILTER SHOULD LOOK LIKE
      vfilter_p1="proj_id="+quote(vproj_id)
      %c%
      
      'BUILD THE FILTER VARIABLE
      evaluate_template("dim vfilter_p"+vseq_no+" as C="+chr(34)+"proj_id="+chr(34)+chr(43)+"quote(vproj_id)")
      msgbox("Line 20",vfilter_p1)
      
      'APPLY THE FILTER
      vproj_name=lookup("projects",vfilter_p1,"proj_name")
      msgbox("Line 24",vproj_name)
      Mike W
      __________________________
      "I rebel in at least small things to express to the world that I have not completely surrendered"

      Comment


        #4
        Mike:

        I created a PROJECTS.DBF with 2 character fields PROJ_ID and PROJ_NAME.

        Something about LOOKUP() is behaving peculiar by me... On 2 different versions of AA.

        Rem out lines 20 and 21 in your code above..

        These two lines:

        eval(vtemp)
        msgbox("21",vtemp+crlf()+vfilter_p1)

        Run your code with projects.dbf with no open forms or browses. Your LOOKUP() fails, right? Not an open index error?

        Now, open projects.dbf default browse.

        Run your code again. Does the LOOKUPC return the PROJ_ID?

        Attached is MY PROJECTS.DBF. Be careful not to overwrite yours IF you need it.

        If your test results are the same, it may be LOOKUP() is buggy. I almost never use it, and it may work in other scenarios.

        I did try a few other filters, all of which worked when the default browse was open, but failed if it was not.

        (Honestly, I open a table, create a query, and fetch as needed - for better or worse...)

        At any rate, you can create a dynamic filter, but LOOKUP() may be off the table.

        Attached Files

        Comment


          #5
          Mike, I use a Quick filter button.
          it's a drill down based on a Browse.
          Click the field, filter on that with the button.

          Say you want a transaction on a specific date. Then a type of transaction.
          Click date - filters on the date chosen
          Click transaction type - filters on date AND type.
          all in user control.
          Then I have a "Print what you see" button.
          See our Hybrid Option here;
          https://hybridapps.example-software.com/


          Apologies to anyone I haven't managed to upset yet.
          You are held in a queue and I will get to you soon.

          Comment


            #6
            Your example on line 23 is mis-spelled:

            vfilter_var_name="vfilter_p"+vseq_no I believe should be "vfilter_pl

            Not sure what you want to do but I built a table defined below.
            My example works fine.

            Code:
            'projects.dbf
            '
            'Proj_Id Character 16 0
            'Proj_Name Character 16 0
            '
            'record 1
            'PRJ.00833
            'Test1
            
            
            dim vfilter_p1 as C
            dim vseq_no as C="1"
            dim vproj_no as C="PRJ.00833"
            dim vfilter_var_name as C
            dim vfilter_val as C
            dim vproj_name as C
            
            <<%c%
            vfilter_p1="proj_id="+quote(vproj_no)
            %c%
            
            vfilter_var_name="vfilter_pl"+vseq_no
            vfilter_val="proj_id"+"="+quote(vproj_no)
            
            '========= WHAT TO DO HERE TO MAKE THE FILTER FROM PARTS ==================
            
            vtemp=vfilter_var_name+"="+vfilter_val
            msgbox("29",vtemp)
            
            'eval(vtemp)
            'msgbox("21",vtemp+crlf()+vfilter_p1)
            
            '===========================================================================
            
            'APPLY THE FILTER
            vproj_name=lookup("projects","proj_id="+s_quote(vproj_no),"proj_name")
            msgbox("38",vproj_name)
            
            vFilter = "proj_id="+s_quote(vproj_no)
            
            vproj_name=lookup("projects",vFilter,"proj_name")
            msgbox("43",vproj_name)
            Last edited by Ronald Anusiewicz; 05-15-2021, 02:00 PM. Reason: revised line numbers in message boxes
            Alpha 5 Version 11
            AA Build 2999, Build 4269, Current Build
            DBF's and MySql
            Desktop, Web on the Desktop and WEB

            Ron Anusiewicz

            Comment


              #7
              Mike

              What are you trying to do in your application that moves you in the direction of building a filter dynamically?

              Call me confused. And when I'm confused I step back and wonder....
              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
                I share Al's confusion. Why is another layer of 'indirection' needed? Are you trying to give the user the ability to create their own query filter expressions in a runtime environment?

                Comment


                  #9
                  Hi all,
                  Yes Tom, that is what my goal was, which I have achieved.
                  We are a Project centered business that uses crowdsourcing for field service workers to perform 3 different work types -audit retail stores, install products in stores, and remove products in stores. I receive a daily reports of the work orders with the Projects, work type, work status...etc from the field services web site. I have developed a method to data mine the daily downloads giving the user the capabilities of selecting three search fields, narrowing the selections with prior selections, to generate a narrowed filter. Works well. I just needed the capabilities to build the filters for secondary; fields and field choices as the user selections were made. I got it worked out. I'll see if I can reduce this to a postable example for others to see.
                  Mike W
                  __________________________
                  "I rebel in at least small things to express to the world that I have not completely surrendered"

                  Comment


                    #10
                    Here is the example I promised.
                    Attached Files
                    Mike W
                    __________________________
                    "I rebel in at least small things to express to the world that I have not completely surrendered"

                    Comment


                      #11
                      Originally posted by Mike Wilson View Post
                      Here is the example I promised.
                      Mke

                      I'm not seeing the example. Did the post to the board actually work?
                      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


                        #12
                        I downloaded it OK, Al.
                        It's a nice piece of work. I would have taken the easier option;
                        https://www.screencast.com/t/Kz1l7rrY5K
                        See our Hybrid Option here;
                        https://hybridapps.example-software.com/


                        Apologies to anyone I haven't managed to upset yet.
                        You are held in a queue and I will get to you soon.

                        Comment


                          #13
                          Originally posted by Ted Giles View Post
                          I downloaded it OK, Al.
                          It's a nice piece of work. I would have taken the easier option;
                          https://www.screencast.com/t/Kz1l7rrY5K
                          Interestingly, if I log out and then view the posts I see many more things. signatures, attachments, colors. My settings must be really messed up...
                          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


                            #14
                            The log in process seems to have changed, Al.
                            Do you want me to mail it to you?
                            See our Hybrid Option here;
                            https://hybridapps.example-software.com/


                            Apologies to anyone I haven't managed to upset yet.
                            You are held in a queue and I will get to you soon.

                            Comment


                              #15
                              Originally posted by Ted Giles View Post
                              The log in process seems to have changed, Al.
                              Do you want me to mail it to you?
                              I have the video now. Got the issues cleared up by pressing the Posts tab instead of the recent activity tab
                              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

                              Working...
                              X