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

Highlighting Search String in Grid Search

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

    Highlighting Search String in Grid Search

    I have a grid component with a search box. When I search for a term, how do I get the results to be displayed with the search term highlighted? Thanks for any help.
    Chris Dickey
    [email protected]

    #2
    Clarification

    I just want to clarify my previous post. I do not know if this is possible, I saw another thread similar, but it didnt seem to apply in this situation. I mostly would like the highlighting, or bolding, to happen if I search for a string in an entry, then the result would appear with the search string highlighted, or bolded. The customer is requesting this, otherwise I wouldnt be that concerned, but it is a nice feature to have. If you dont think this is possible, please let me know. Thanks.
    Chris Dickey
    [email protected]

    Comment


      #3
      There is no built in ability to do this. However you could add it with a little bit of Xbasic code added to your A5W page that contains the grid.

      First look at the HTML source of your page with the grid as it is displayed in your browser. You need to find the textbox control for the serach term. It will look something like:
      HTML Code:
      <input id="BIG_grid_S_FIRSTNAME" size="40" maxlength="200"  class="AirportInput" type="TEXT" name="BIG_grid_S_FIRSTNAME" value="" >
      The above is the firstname search box in a grid named "big_grid". make a note of the value in the name, in this case BIG_grid_S_FIRSTNAME. This will be a variable on your A5W page that contains the user's input.

      Now add some Xbasic code to your A5W page to modify the grid output before it is displayed. This means your code needs to be added after the a5w_run_component() call but before the ?x_out.Output.Body.Grid_HTML. In your Xbasic, you'll simply wrap the string you want to highlight with some HTML markup.

      Using the example above, the following would highlight your search term by changing the text color to red. You could apply fancier formatting if desired using different HTML markup.
      Code:
      if eval_valid("BIG_grid_S_FIRSTNAME")
          x_out.Output.Body.Grid_HTML = stritran(x_out.Output.Body.Grid_HTML,BIG_grid_S_FIRSTNAME,"<font color=red>" + BIG_grid_S_FIRSTNAME + "</font>")
      end if

      Lenny Forziati
      Vice President, Internet Products and Technical Services
      Alpha Software Corporation

      Comment


        #4
        Thanks a lot Lenny, works great!

        If anyone else trys to use this code, the closing " is misplaced.
        Chris Dickey
        [email protected]

        Comment


          #5
          Next search?

          I gave this ago but two things happened I need help with - first the actual html comands displayed not the bold or color and when I selected next page to list it failed because the html codes were now in the search. Any ideas?
          Insanity: doing the same thing over and over again and expecting different results.
          Albert Einstein, (attributed)
          US (German-born) physicist (1879 - 1955)

          Comment


            #6
            Check your quote placement. That was my problem. If that doesnt work, post a snippet of your code, and i'll take a look.
            Chris Dickey
            [email protected]

            Comment


              #7
              Take a look at Highlighting Search Terms in Grid Records.

              Comment


                #8
                Peter, first review Ed's link above for more detailed instructions than what I had originally posted. If you are still having a problem, please post your specific code. It sounds like you are doing an stritran() on the search part instead of the grid HTML. That would then cause the HTML tags to get inserted in the same place and be shown in the search part.

                Originally posted by peteconway
                I gave this ago but two things happened I need help with - first the actual html comands displayed not the bold or color and when I selected next page to list it failed because the html codes were now in the search. Any ideas?

                Lenny Forziati
                Vice President, Internet Products and Technical Services
                Alpha Software Corporation

                Comment


                  #9
                  Thanks for pointing that out. Sorry about the confusion, I had composed the Xbasic code right here in my browser instead of Alpha Five where the syntax would have been verified for me. I have edited my original post to fix the quote placement.

                  Originally posted by acidcigarfiend
                  Thanks a lot Lenny, works great!

                  If anyone else trys to use this code, the closing " is misplaced.

                  Lenny Forziati
                  Vice President, Internet Products and Technical Services
                  Alpha Software Corporation

                  Comment


                    #10
                    Here is the source.

                    When I use this the next page search fails because it now has HTML in it and When it does display it shows <font color=blue><b>mozart</b></font>, Wolfgang Amadeus (Johann Chrysostom) (1756-1791). In the grid.

                    <html>
                    <head>



                    <%a5
                    Delete tmpl_dwbsearch
                    DIM tmpl_dwbsearch as P
                    tmpl_dwbsearch = a5w_load_component("dwbsearch")
                    '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_dwbsearch
                    componentName = "dwbsearch"
                    end with
                    '=======================================compute the HTML for the Component=======================================
                    delete x_dwbsearch
                    dim x_dwbsearch as p
                    tmpl_dwbsearch.request = request
                    tmpl_dwbsearch.session = session
                    tmpl_dwbsearch.response = response
                    tmpl_dwbsearch.serversetting = serversetting
                    tmpl_dwbsearch.PageVariables = local_variables()
                    x_dwbsearch = a5w_run_Component(tmpl_dwbsearch)
                    '=============================================================================================================
                    if x_dwbsearch.RedirectURL <> "" then
                    response.redirect(x_dwbsearch.redirectURL)
                    end
                    end if


                    ?x_dwbsearch.Output.Head.JavaScript
                    ?x_dwbsearch.Output.Head.CSS_Link

                    if (eval_valid("dwbsearch_s_Keyword")) then
                    x_dwbsearch.Output.Body.Grid_HTML = stritran(x_dwbsearch.Output.Body.Grid_HTML, dwbsearch_s_Keyword, "<font color=blue><b>" + dwbsearch_s_Keyword + "</b></font>")
                    end if

                    %>
                    <!--Alpha Five Temporary Code Start - Will be automatically removed when page is published -->
                    <!--CSS for tmpl_dwbsearch -->
                    <link rel="stylesheet" type="text/css" href="file:///C:\Program Files\A5V7/css/Parallel/style.css">
                    <!--Alpha Five Temporary Code End -->


                    <meta name="generator" content="Alpha Five HTML Editor">
                    <title></title>
                    </head>
                    <body bgColor=#f3f2f2 background="">
                    <p align=center><input type="image" id="image1" name="image1" src="dwb.jpg"></p>
                    <p>
                    <br>
                    <table align=center>
                    <tr>
                    <td><%A5 ?x_dwbsearch.Output.Body.Grid_Echo %></td>
                    </tr>
                    <tr>
                    <td><%A5 ?x_dwbsearch.Output.Body.UpdateErrors %></td>
                    </tr>
                    <tr>
                    <td><%A5 ?x_dwbsearch.Output.Body.Search_HTML %></td>
                    </tr>
                    <tr>
                    <td><%A5 ?x_dwbsearch.Output.Body.Grid_HTML %></td>
                    </tr>
                    <tr>
                    <td><%A5 ?x_dwbsearch.Output.Body.DetailView_HTML %></td>
                    </tr>
                    </table></p>
                    </body></html>
                    Insanity: doing the same thing over and over again and expecting different results.
                    Albert Einstein, (attributed)
                    US (German-born) physicist (1879 - 1955)

                    Comment


                      #11
                      You will have to clear the search before running another one, or create a script that reverses the search and replace.

                      Comment


                        #12
                        OK - but what about the html showing up.

                        Is there a trick to this, html (memo) or whatever (I glad I'm not going crazy)
                        <font color=blue><b>Mozart</b></font>, Wolfgang Amadeus (Johann Chrysostom) (1756-1791).
                        . Also IE still does not want to display special characters in html, I can't find an answer fo this anywhere. How can I force it to display what A5 want's iy to?
                        e.g.K�chel, Ludwig (Alois Ferdinand) NOT K?l, Ludwig (Alois Ferdinand) (1800-1877)
                        Insanity: doing the same thing over and over again and expecting different results.
                        Albert Einstein, (attributed)
                        US (German-born) physicist (1879 - 1955)

                        Comment


                          #13
                          The issue is that your search term, mozart, appears in each of the links for the grid navigation. The links will contain something like dwbsearch_s_Keyword=mozart in them. The stritran simply looks for all occurances of mozart and changes them all. There are a few different ways you can prevent this from happening. Here is probably the simplest, though maybe not the most elegant:
                          Code:
                          if (eval_valid("dwbsearch_s_Keyword")) then
                              dim tmp_txt as c
                              tmp_txt = "dwbsearch_s_Keyword=" + dwbsearch_s_Keyword
                              'temporarily replace the search term in the link with a placeholder
                              x_dwbsearch.Output.Body.Grid_HTML = stritran(x_dwbsearch.Output.Body.Grid_HTML,tmp_text,"$$$$")
                              'highlight the search term in the grid
                              x_dwbsearch.Output.Body.Grid_HTML = stritran(x_dwbsearch.Output.Body.Grid_HTML, dwbsearch_s_Keyword, "<font color=blue><b>" + dwbsearch_s_Keyword + "</b></font>")
                              'change the link placeholders back to the original state
                              x_dwbsearch.Output.Body.Grid_HTML = stritran(x_dwbsearch.Output.Body.Grid_HTML,"$$$$",tmp_text)
                          end if
                          The code above uses "$$$$" as a temporary placeholder for the search string within the URLs. You can use any value, as long as it is something that will never appear in your data itself. If for some reason your data might contain $$$$, you would need to change this.

                          Originally posted by peteconway
                          When I use this the next page search fails because it now has HTML in it and When it does display it shows <font color=blue><b>mozart</b></font>, Wolfgang Amadeus (Johann Chrysostom) (1756-1791). In the grid.

                          Lenny Forziati
                          Vice President, Internet Products and Technical Services
                          Alpha Software Corporation

                          Comment


                            #14
                            Many thanks Lenny

                            I'll give it a go - what about the special characters.
                            Insanity: doing the same thing over and over again and expecting different results.
                            Albert Einstein, (attributed)
                            US (German-born) physicist (1879 - 1955)

                            Comment


                              #15
                              now that ive checked this out some more, the first page works fine and highlights the search terms perfectly, but if there are multiple pages, page 2 doe s not work. The search field now contains <strong><font color=0066CC> constitutional </strong></font> and nothing is highlighted in the grid. Are there any ideas out there for how to make this work for all pages? Thanks
                              Chris Dickey
                              [email protected]

                              Comment

                              Working...
                              X