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

Programming a filtered dropdown search field above the grid

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

    Programming a filtered dropdown search field above the grid

    Can it be done without doing it in a dialog? I was looking at Before Search events and putting filters in the a5w page, but haven't had any luck.

    How cool would it be to have the equivalent of a cascading (filtered in this case with a session variable) pulldown in the built-in search above grids when the user wanted to find something?

    I know you can hard code a filter with a constant but that isn't helpful for me at least.

    Can this be done? Alpha?

    #2
    Clint,

    This code works for me:

    Code:
    if eval_valid("session.org_id") ' session.org_id exists 
        if (session.org_id <> "") ' value exists
    		If (session.__protected__SecurityLevel <> 7)
    			tmpl.DBF.filter = "Organization_Id=\""+session.org_id+"\"" 
    			tmpl.SearchField_Info[1].DropDownBox.Filter = "Organization_Id=\""+session.org_id+"\""
    			tmpl.DetailField_Info[1].DropDownBox.Filter = "Organization_Id=\""+session.org_id+"\"" 
    		end if
        end if 
    end if

    SearchField_Info[1] is your searchfield indexed by a number. You can lookup the number in the xbasic of your component. You insert the code in the a5w page which contains the component.

    In my case I only display records of a certain organization where the logon user is attached to. Except when this user has security level =7. In which case this user can see and search all records for all organizations.

    regards, Ron
    Last edited by rleunis; 04-08-2006, 05:05 AM.

    Comment


      #3
      Originally posted by rleunis
      Clint,

      This code works for me:

      Code:
      if eval_valid("session.org_id") ' session.org_id exists 
          if (session.org_id <> "") ' value exists
      		If (session.__protected__SecurityLevel <> 7)
      			tmpl.DBF.filter = "Organization_Id=\""+session.org_id+"\"" 
      			tmpl.SearchField_Info[1].DropDownBox.Filter = "Organization_Id=\""+session.org_id+"\""
      			tmpl.DetailField_Info[1].DropDownBox.Filter = "Organization_Id=\""+session.org_id+"\"" 
      		end if
          end if 
      end if

      SearchField_Info[1] is your searchfield indexed by a number. You can lookup the number in the xbasic of your component. You insert the code in the a5w page which contains the component.

      In my case I only display records of a certain organization where the logon user is attached to. Except when this user has security level =7. In which case this user can see and search all records for all organizations.

      regards, Ron

      Thanks Ron, I'd like to try that. Would I put code like this in the same place I'd put code if I wanted to filter the grid or somewhere else?

      I'll include a sample of the filtering I mentioned above.

      Delete tmpl_GrdClassReview
      DIM tmpl_GrdClassReview as P
      tmpl_GrdClassReview = a5w_load_component("GrdClassReview")
      'Following code allows you to override settings in the saved component, and specify the component alias (componentName property).
      'Tip: Keep the componentName property short because this name is used in page URLs, and it will help keep the URLs short.
      'Each component on a page must have a unique alias (componentName property).
      with tmpl_GrdClassReview
      .dbf.filter = "Officenbr = " + s_quote(session.FromOffice)
      .field_info[1].DropDownBox.Filter = "Officenbr = " + s_quote(session.FromOffice)
      .field_info[2].DropDownBox.Filter = "Officenbr = " + s_quote(session.FromOffice)
      .field_info[8].DropDownBox.Filter = "Officenbr = " + s_quote(session.FromOffice)
      componentName = "GrdClassReview"
      end with

      Thanks again

      Comment


        #4
        Clint,

        Yes, place it same place as the DBF.filter in the webpage.
        Alpha Five webhelp give following example:

        Code:
        with tmpl_Selected_Invoic
            componentName = "Selected_Invoic"
            DBF.filter = "userID = \"" + session.__protected__UserID + chr(34) 
            field_info[7].DropDownBox.Filter = "userID = \"" + session.__protected__UserID + chr(34)
        end with
        So I would place > componentName = "GrdClassReview" <
        right after > with tmpl_GrdClassReview< ... Because I am not sure if you leave it like this it will generate an error or not..

        And if you have a grid with detailview and this detailview also contains a dropdown, then you can use the tmpl.DetailField_Info[1].DropDownBox.Filter.

        You should be able to use this code also in Lookups but then in the override section of the lookup definition. But I did not give that a try yet. Maybe somebody else has experience with that?

        good luck, Ron
        Last edited by rleunis; 04-09-2006, 03:47 PM.

        Comment


          #5
          You can see another example in Filtering a Grid with a Session Variable.

          Comment


            #6
            Originally posted by rleunis
            Clint,

            Yes, place it same place as the DBF.filter in the webpage.
            Alpha Five webhelp give following example:

            Code:
            with tmpl_Selected_Invoic
                componentName = "Selected_Invoic"
                DBF.filter = "userID = \"" + session.__protected__UserID + chr(34) 
                field_info[7].DropDownBox.Filter = "userID = \"" + session.__protected__UserID + chr(34)
            end with
            So I would place > componentName = "GrdClassReview" <
            right after > with tmpl_GrdClassReview< ... Because I am not sure if you leave it like this it will generate an error or not..

            And if you have a grid with detailview and this detailview also contains a dropdown, then you can use the tmpl.DetailField_Info[1].DropDownBox.Filter.

            You should be able to use this code also in Lookups but then in the override section of the lookup definition. But I did not give that a try yet. Maybe somebody else has experience with that?

            good luck, Ron
            Alpha's help didn't help because it doesn't reference search fields.

            Here is my code below. It fails when run because it can't resolve the search field. The search field is correctly named as a review of the Xbasic shows.

            Delete tmpl_GrdLGAudit
            DIM tmpl_GrdLGAudit as P
            tmpl_GrdLGAudit = a5w_load_component("GrdLGAudit")
            with tmpl_GrdLGAudit
            componentName = "GrdLGAudit"
            if eval_valid("session.FromOffice") ' session.org_id exists
            tmpl.SearchField_Info[2].DropDownBox.Filter = "Officenbr = \"" + session.FromOffice + chr(34)
            end if
            end with


            Do you have an example where you modify a search pulldown that is complete so I can compare it to what I'm doing? Does Alpha?

            Thanks, I feel I'm close and an example showing the concept in use would really help me identify my error. Thanks Ron, Thanks Alpha

            Comment


              #7
              Code:
              Delete tmpl_GrdLGAudit
              DIM tmpl_GrdLGAudit as P
              tmpl_GrdLGAudit = a5w_load_component("GrdLGAudit")
              with tmpl_GrdLGAudit
                  componentName = "GrdLGAudit"
                  if eval_valid("session.FromOffice") ' session.org_id exists
                      [B]tmpl[/B].SearchField_Info[2].DropDownBox.Filter = "Officenbr = \"" +  session.FromOffice + chr(34)
                  end if
              end with
              The bolded code is causing a problem. Remove it. You are saying: "tmpl_GrdLGAudit.tmpl.SearchField_Info[2].DropDownBox.Filter = " and should be saying "tmpl_GrdLGAudit.SearchField_Info[2].DropDownBox.Filter = ".

              Comment


                #8
                Originally posted by Edward Larrabee
                Code:
                Delete tmpl_GrdLGAudit
                DIM tmpl_GrdLGAudit as P
                tmpl_GrdLGAudit = a5w_load_component("GrdLGAudit")
                with tmpl_GrdLGAudit
                    componentName = "GrdLGAudit"
                    if eval_valid("session.FromOffice") ' session.org_id exists
                        [B]tmpl[/B].SearchField_Info[2].DropDownBox.Filter = "Officenbr = \"" +  session.FromOffice + chr(34)
                    end if
                end with
                The bolded code is causing a problem. Remove it. You are saying: "tmpl_GrdLGAudit.tmpl.SearchField_Info[2].DropDownBox.Filter = " and should be saying "tmpl_GrdLGAudit.SearchField_Info[2].DropDownBox.Filter = ".
                Wow, that did it. I greatly appreciate your and Ron's assistance.

                Will Alpha will include help elaborating web related modification of grid defaults (like this for *search* fields above) in it's helpfiles in the near future?

                I'm also really looking forward to clearer help files indicating which platform (Web vs Desktop) functions relate to. I think everyone would be able to program with less problems if there were clean examples of each function and designation of its Web vs Desktop usage.

                Perhaps you could break the help into a Web section and one for Desktop like you do in the forum?

                Thanks again

                Comment


                  #9
                  Functions and methods that are inappropriate in web applications are those that display messages or dialog boxes. In other cases where functions or methods are incompatible, I am documenting them as they turn up.

                  Comment


                    #10
                    Originally posted by Edward Larrabee
                    Functions and methods that are inappropriate in web applications are those that display messages or dialog boxes. In other cases where functions or methods are incompatible, I am documenting them as they turn up.
                    While I understand what you've written above "applications are those that display messages or dialog boxes" "are inappropriate in web applications", how would a new user know that?

                    Wouldn't it be better for Alpha to do what Alpha does in the forums (where we are now), break into sections for Desktop versus Web, functions that only work in Desktop and functions that only work on the WAS. Those that work in both would be included in both.

                    How can this not be the best way to represent the complexity of the code in the help file? Other than it taking Alpha some effort to segregate the help meaningfully for their paying customer base, what reason would there be *not* to do that way?

                    Again, I thank Alpha for assisting this customer.

                    (Hmm, I'm talking about myself in the 3rd person, that's just wrong ;) ).

                    Comment


                      #11
                      You can easily tell which functions or methods display messages or dialogs by checking the help files. At least 90 percent of Xbasic functions and methods are usable in both desktop and web applications.

                      Comment

                      Working...
                      X