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

how and hide a column based on search criteria

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

    how and hide a column based on search criteria

    I have a grid that displays data from a table. The search age (numeric field) is keyed in by the user in search box. I want to show one of the columns if the search age is less than 19. If the age is more than 19 the column should be hidden.

    The grid can be seen in this page: http://www.ghicenter.net/ghi_com/cp_cat1.a5w
    The column I want to show and hide is �dependent�. If you visit this page, please key in an age in the search box. The grid will show the columns with data.

    Can somebody help me accomplish this?
    Last edited by chandran; 12-16-2006, 03:59 PM. Reason: Correction to typos
    sigpic

    #2
    Re: how and hide a column based on search criteria

    Search fields become page variables. For example, my search field "CITY" below becomes customer_S_CITY where my grid component is named "Customer". So the following code in the A5W page would hide column 1 if the search value was "san francisco". You'll have to play with it using "if component_S_Age>19", etc. You may have to use convert_type() function if your value is a numeric.


    if eval_valid("customer_S_CITY") then
    if customer_S_CITY = "San Francisco" then
    field_info[1].Column.Hide = .t.
    end if
    end if
    Steve Wood
    See my profile on IADN

    Comment


      #3
      Re: show and hide a column based on search criteria

      Thanks for your prompt response and help. I will try and let you know if it works.

      You suggested my using your code in A5W page. I do not know where it keep this code and try.

      I was thinking of using an IIF function in the component. But as mentioned earlier, I do not know how to do it.

      Any further advice to accomplish my task is very welcome. I have to complete this in a couple of days. Please help.

      Thanks,
      sigpic

      Comment


        #4
        Re: how and hide a column based on search criteria

        I have tried the suggestion by Steve and not successful. Can somebody help? I realise Steve is very busy with his new project of hosting service. I need this solution as early as possible. Please help.

        Thanks,
        sigpic

        Comment


          #5
          Re: how and hide a column based on search criteria

          hi Chandran

          Steve should be right

          if eval_valid("customer_S_CITY") then
          if customer_S_CITY = "San Francisco" then
          field_info[1].Column.Hide = .t.
          end if
          end if


          in your case

          if eval_valid("cp_cat1_S_AGE") then
          if cp_cat1_S_AGE > 19 then
          field_info[XX].Column.Hide = .t.
          end if
          end if


          this must be placed in the proper part of the a5w page
          in the section that is right after the
          tmpl_mycomponentalias = a5w_load_component("mycomponentalias")
          see this code as an example

          Code:
          <%a5
          Delete tmpl_LinkUser
          DIM tmpl_LinkUser as P
          tmpl_LinkUser = a5w_load_component("LinkUser")
          '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_LinkUser
          	componentName = "LinkUser"
          		if eval_valid("session.userid") = .t. then
          		DBF.filter = "User_id =" + session.userid
          		end if
          end with
          yours would be something like this

          Code:
          Delete tmpl_YOURCOMPONENTALIASNAME
          DIM tmpl_YOURCOMPONENTALIASNAME as P
          tmpl_LinkUser = a5w_load_component("YOURCOMPONENTALIASNAME")
          '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_YOURCOMPONENTALIASNAME
          	componentName = "YOURCOMPONENTALIASNAME"
          		if eval_valid("cp_cat1_S_AGE") = .t. then
                          if cp_cat1_S_AGE > 19 then
                            field_info[[COLOR="Red"]XX[/COLOR]].Column.Hide = .t.
                          end if
                          end if
          end with
          if you check the xbasic code in the component builder you will
          be able to determine which column number to hide


          hth
          regards

          martin
          www.jollygreenthumb.com

          Comment


            #6
            Re: how and hide a column based on search criteria

            Sorry, I'd forgotten to fill in the details. Martin is right about where the code has to go, and how you determine the value for XX. By the way, the value for XX may change if you add, move or remove any of your grid fields, since XX is sequential starting with the first column.
            Steve Wood
            See my profile on IADN

            Comment


              #7
              Re: how and hide a column based on search criteria

              Thanks for all the help. But for this type of support I would have gone mad.

              I will try the code today and let you know the result.
              sigpic

              Comment


                #8
                Re: how and hide a column based on search criteria

                Originally posted by martin horzempa View Post
                hi Chandran

                Steve should be right

                if eval_valid("customer_S_CITY") then
                if customer_S_CITY = "San Francisco" then
                field_info[1].Column.Hide = .t.
                end if
                end if


                in your case

                if eval_valid("cp_cat1_S_AGE") then
                if cp_cat1_S_AGE > 19 then
                field_info[XX].Column.Hide = .t.
                end if
                end if


                this must be placed in the proper part of the a5w page
                in the section that is right after the
                tmpl_mycomponentalias = a5w_load_component("mycomponentalias")
                see this code as an example

                Code:
                 19 then
                                  field_info[[COLOR="Red"]XX[/COLOR]].Column.Hide = .t.
                                end if
                                end if
                end with
                if you check the xbasic code in the component builder you will
                be able to determine which column number to hide


                hth
                I did key in the code as mentioned by you. I am getting an error 500message as below:

                500 Internal Server Error
                Script Error
                Error:Script: /ghi_com/cp_c1_copy.a5w line:15
                if cp_cat1_S_AGE>19 then
                Argument is incorrect data type

                The age field is Numeric.

                Kindly let me know what I should change. If I were to change the data type to character, I will be re-doing lot of other tables and data.

                Please let me know.

                Thanks,
                sigpic

                Comment


                  #9
                  Re: how and hide a column based on search criteria

                  Hi Chadran

                  if cp_cat1_S_AGE > 19 then

                  try

                  if cp_cat1_S_AGE > "19" then
                  regards

                  martin
                  www.jollygreenthumb.com

                  Comment


                    #10
                    Re: how and hide a column based on search criteria

                    Originally posted by martin horzempa View Post
                    Hi Chadran

                    if cp_cat1_S_AGE > 19 then

                    try

                    if cp_cat1_S_AGE > "19" then
                    I tried this even before your post. It did not hide the column. I created another table and changed the age field to character and keyed in the following:

                    with tmpl_cp_c1c
                    componentName = "cp_c1c"
                    if eval_valid("cp_c1c_S_AGE") =.t.
                    if cp_c1c_S_AGE > "19" then
                    field_info(9).Column.Hide =.t.
                    end if
                    end if
                    end with



                    When I tried this I am getting the message below:

                    500 Internal Server Error
                    Script Error
                    Error:Script: /hide_dep.a5w line:15
                    field_info(9).Column.Hide =.t.
                    Function is not recognized

                    What could be the reason?

                    Please help.

                    Thanks,
                    sigpic

                    Comment


                      #11
                      Re: how and hide a column based on search criteria

                      I found the mistake I had made. It was a typo. I think the "19"
                      works.

                      Thanks for all your help and immediate responses.
                      sigpic

                      Comment


                        #12
                        Re: how and hide a column based on search criteria

                        Originally posted by chandran View Post
                        I found the mistake I had made. It was a typo. I think the "19"
                        works.

                        Thanks for all your help and immediate responses.
                        I have an additional request to make. I have a linked grid in a a5w page. I am unable to get the above work, after several trials.

                        How do I use the above code in a linked grid?

                        Please respond as quickly as possble.

                        Thanks,
                        sigpic

                        Comment


                          #13
                          Re: how and hide a column based on search criteria

                          Originally posted by chandran View Post
                          I have an additional request to make. I have a linked grid in a a5w page. I am unable to get the above work, after several trials.

                          How do I use the above code in a linked grid?

                          Please respond as quickly as possble.

                          Thanks,
                          Here is a copy of the html of c3_link.a5w for your use.

                          <html>
                          <head>

                          <%a5
                          Delete tmpl_GridLinker
                          DIM tmpl_GridLinker as P
                          tmpl_GridLinker = a5w_load_component("c3_link")
                          '=======================================compute the HTML for the Component=======================================
                          delete x_GridLinker
                          dim x_GridLinker as p
                          tmpl_GridLinker.request = request
                          tmpl_GridLinker.session = session
                          tmpl_GridLinker.response = response
                          tmpl_GridLinker.serversetting = serversetting
                          tmpl_GridLinker.PageVariables = local_variables()
                          x_GridLinker = a5w_run_Component(tmpl_GridLinker)
                          '=============================================================================================================
                          if x_GridLinker.cp_c3.RedirectURL <> "" then
                          response.redirect(x_GridLinker.cp_c3.redirectURL)
                          end
                          end if
                          if x_GridLinker.cp_c32.RedirectURL <> "" then
                          response.redirect(x_GridLinker.cp_c32.redirectURL)
                          end
                          end if
                          ?x_GridLinker.cp_c3.Output.Head.JavaScript
                          ?x_GridLinker.cp_c32.Output.Head.JavaScript
                          ?x_GridLinker.cp_c3.Output.Head.CSS_Link
                          ?x_GridLinker.cp_c32.Output.Head.CSS_Link
                          %>
                          <!--Alpha Five Temporary Code Start - Will be automatically removed when page is published -->
                          <!--CSS for tmpl_GridLinker -->
                          <link rel="stylesheet" type="text/css" href="file:///C:\Program Files\A5V7/css/mmis2/style.css">
                          <!--Alpha Five Temporary Code End -->

                          <meta name="generator" content="Alpha Five HTML Editor">
                          <title></title>

                          <link rel="stylesheet" type="text/css" href="dd_layout.css">
                          <link rel="stylesheet" type="text/css" href="dd_menu.css">
                          <script type="text/javascript" src="automax.js"></script>

                          </head>
                          <body class="mmis2PageBODY" OnLoad="window.defaultStatus='Global Health Insurance Center - p: 408.270.1854 | 408.528.7687 - e:

                          [email protected]';">


                          <div id="maincontainer">

                          <div id="topsection"><div class="innertube">
                          <div id="toprs">
                          <a href="http://www.ghicenter.com/">
                          <img height=30 src="home.gif" width=30 border=0></a></div>
                          <img height=36 src="logo_mmis2.jpg" width=320 border=0></div></div>

                          <div id="topnav">
                          <div class="innertubetopnav"><div class="stylenav">

                          <a href="http://www.ghicenter.net/ghi_com/app_desc.a5w">Applicant Description</a> |
                          <font color="#ff0000">Product Finder, Compare Premium and Compare Features:</font>
                          <a href="http://www.ghicenter.com/us_intro.htm">for US Citizens </a>| <a href="http://www.ghicenter.com/nus_intro.htm">for Non-US

                          Citizens</a>

                          </stylenav>

                          </div> </div> </div>


                          <div id="contentwrapper"><div id="contentcolumn">
                          <div class="innertubecontent"><div class="stylecontent">
                          <p><br>
                          <table>
                          <tr>
                          <td vAlign=center align=middle background="" bgColor=#ebffff colSpan=2
                          ><font
                          size=2><a href="cat3_msg.htm">Click for notes on this
                          comparison</a></font></td>
                          </tr>
                          <tr>
                          <td vAlign=center align=left background="" colSpan=2
                          ><%A5 ?x_GridLinker.cp_c3.Output.Body.Search_HTML %></td>
                          </tr>
                          <tr>
                          <td vAlign=center align=left colSpan=2><%A5 ?x_GridLinker.cp_c3.Output.Body.Grid_HTML %><%A5

                          ?x_GridLinker.cp_c3.Output.Body.DetailView_HTML %></td></tr>
                          <tr>
                          <td vAlign=center align=left><%A5 ?x_GridLinker.cp_c32.Output.Body.Search_HTML %></td>
                          <td vAlign=center align=left></td></tr>
                          <tr>
                          <td vAlign=center align=left background="" colSpan=2
                          ><%A5 ?x_GridLinker.cp_c32.Output.Body.Grid_HTML %><%A5 ?x_GridLinker.cp_c32.Output.Body.DetailView_HTML %></td>
                          </tr>
                          </table><br><br></p>

                          </div>
                          </div></div></div>


                          <div id="leftcolumn"><div class="innertube">
                          <ul class="markermenu">

                          <li><a href="http://www.ghicenter.net/ghi_com/pf_cat3.a5w">Assist Me!!</a>
                          <li><a href="http://www.ghicenter.com/cat3_compare.htm">Comparisons</a>
                          <li><a href="http://www.ghicenter.com/atlas_am_hl.htm">Atlas America</a>
                          <li><a href="http://www.ghicenter.com/hca_hl.htm">HealthCare America</a>
                          <li><a href="http://www.ghicenter.com//hci_nus_hl.htm">HealthCare International</a>
                          <li><a href="http://www.ghicenter.com/iim_hl.htm">Inbound Immigrant</a>
                          <li><a href="http://www.ghicenter.com/ius_hl.htm">Inbound USA</a>
                          <li><a href="http://www.ghicenter.com/li_nus_hl.htm">Liaison International</a>
                          <li><a href="http://www.ghicenter.com/pata_hl.htm">Patriot America</a>
                          <li><a href="http://www.ghicenter.com/vua_hl.htm" >Visit USA</a>
                          <li><a href="http://www.ghicenter.com/vic_hl.htm" >Visitors Care</a>
                          <li><a href="http://www.ghicenter.com/wmd_nus_hl.htm" >WorldMed</a>
                          <li><a href="http://www.ghicenter.com/about.htm">About MM Insurance Srvcs.</a>
                          <li><a href="http://www.ghicenter.com/contact.htm" style="BORDER-BOTTOM-WIDTH: 0px">Contact</a></li>



                          </ul>



                          </div>

                          </div>
                          <div class="innertubefooter">
                          <div id="footer"><div class="stylefooter">
                          <a style="TEXT-DECORATION: none" href="mailto:[email protected]?subject=From Web site ">Copyright � MM Insurance Services | e:

                          [email protected] </a>| p: 408.270.1854 and
                          408.528.7687 | skype: ghicenter
                          </stylefooter></a></div>

                          </div></div></div>

                          </body>
                          </html>
                          sigpic

                          Comment


                            #14
                            Re: how and hide a column based on search criteria

                            field_info(9).Column.Hide =.t. will never work. The function uses square brackets, as in field_info[19].Column.Hide =.t.

                            I know its a bit confusing, but override statements (like one you are trying to write) for grid linker components do not go in the A5W page. Unless you've done it before, its almost impossible to know where to put your code.

                            Open the grid linker component, highlight the grid that you want to control and select Edit. Then click Override Settings and place your code there, under the Override Properties tab. You might also look under the existing properties tab to see if you can locate the column you want to control and confirm you have the right value for XX in your statement : field_info(XX).Column.Hide =.t.
                            Steve Wood
                            See my profile on IADN

                            Comment


                              #15
                              Re: how and hide a column based on search criteria

                              ok Chandran

                              lets give this a shot

                              i found in the help docs

                              "Overriding GridLinker Component Settings"
                              http://support.alphasoftware.com/alp...t_Settings.htm

                              so give this a try

                              read the docs and find the correct place for the code


                              Delete tmpl_c3_link
                              DIM tmpl_c3_link as P
                              tmpl_LinkUser = a5w_load_component("c3_link")
                              '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).
                              dim tooold as C
                              with tmpl_c3_link
                              componentName = "c3_link"
                              if eval_valid("cp_c3_S_AGE") = .t. then
                              if cp_cat1_S_AGE > "19" then
                              tooold = "Y"
                              end if
                              end if
                              end with

                              if tooold = Y then
                              'if tooold = "Y" then set the column hide property to .t. for the depenedent grids

                              dim indx as N
                              'find the entry in the tmpl.grid_info[] array for the component with the alias 'DEPENDENT#1ALIAS etc'

                              indx = tmpl_c3_link.grid_info.find(ut("DEPENDENT#1ALIAS"), "ut(componentalias)")
                              'if (indx > 0) then a match was found
                              if (indx > 0) then
                              with tmpl_c3_link
                              with Grid_Info[DEPENDENT#1FIELDNUMBER]
                              .OverrideSettings = <<%code%
                              .Column.Hide = .t.
                              %code%
                              end with
                              end with
                              end if



                              indx = tmpl_c3_link.grid_info.find(ut("DEPENDENT#2ALIAS"), "ut(componentalias)")
                              'if (indx > 0) then a match was found
                              if (indx > 0) then
                              with tmpl_c3_link
                              with Grid_Info[DEPENDENT#2FIELDNUMBER]
                              .OverrideSettings = <<%code%
                              .Column.Hide = .t.
                              %code%
                              end with
                              end with
                              end if

                              end if

                              this should work -- if anyone can see an error ,please jump in
                              but i believe this is how it should work though i have never done it myself

                              hth
                              regards

                              martin
                              www.jollygreenthumb.com

                              Comment

                              Working...
                              X