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

Hiding a column in Grid

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

    Hiding a column in Grid

    I have used a code suggested in this forum to hide a column in Grid (A5. Ver 7). The suggestion and help was given by Martin Harzempa and Steve Woods. The code was:

    if eval_valid("cp_c3_S_AGE") = .t. then
    if cp_c3_S_AGE > "19" then
    field_info[9].Column.Hide =.t.
    else
    field_info[9].Column.Hide =.f.
    end if
    end if

    I am recreating the same grid now in Alpha Five Version 9. The code does not hide the column as before. The code I am using now is given below:

    with tmpl_srch_prm
    comp
    if eval_valid("srch_prm") = .t. then
    if srch_prm > "18" then
    field_info[16].Column.Hide =.t.
    else
    field_info[16].Column.Hide =.f.
    end if
    end if
    end with

    What could have gone wrong? Early response will help me complete my job.
    Thanks,
    sigpic

    #2
    Re: Hiding a column in Grid

    Originally posted by chandran View Post
    with tmpl_srch_prm
    comp
    if eval_valid("srch_prm") = .t. then
    if srch_prm > "18" then
    field_info[16].Column.Hide =.t.
    else
    field_info[16].Column.Hide =.f.
    end if
    end if
    end with
    chandran,try this way.

    with tmpl_audit_verif
    componentName = "audit_verif"

    if eval_valid("srch_prm") = .t. then
    with tmpl_audit_verif.field_info[14]
    .Fieldname = "actualpercent"
    .Column.Hide = .t.
    end with
    end if
    end with
    Thanks & Regards,
    RR


    Wonder rather than doubt is the root of all knowledge

    Comment


      #3
      Re: Hiding a column in Grid

      I did change the code as below:

      ----------------------------------------------------------------
      with tmpl_srch_prm
      componentName = "srch_prm"
      if eval_valid("srch_prm") = .t. then
      with tmpl_srch_prm.field_info[16]
      if .TxtsrchAge = ">18"
      .Column.Hide = .t.
      else
      field_info[16].Column.Hide =.f.
      end if

      end if
      end with
      ---------------------------------------------------------------------

      When I execute the file, I get the following message:

      500 Internal Server Error
      "Script Error
      Error:Missing END WITH command."

      Please let me know the mistake.

      Thanks,
      sigpic

      Comment


        #4
        Re: Hiding a column in Grid

        Originally posted by chandran View Post
        I did change the code as below:

        ----------------------------------------------------------------
        with tmpl_srch_prm
        componentName = "srch_prm"
        if eval_valid("srch_prm") = .t. then
        with tmpl_srch_prm.field_info[16]
        if .TxtsrchAge = ">18"
        .Column.Hide = .t.
        else
        field_info[16].Column.Hide =.f.
        end if
        end width
        end if
        end with
        Fixed by doing as the error message says, e.g. add another end with (bold)

        Comment


          #5
          Re: Hiding a column in Grid

          I changed the code as given by you:
          with tmpl_srch_prm
          componentName = "srch_prm"
          if eval_valid("srch_prm") = .t. then
          with tmpl_srch_prm.field_info[16]
          if .TxtsrchAge = ">18"
          .Column.Hide = .t.
          else
          field_info[16].Column.Hide =.f.
          end if
          end width
          end if
          end with

          I am still getting the same error message


          Please help.

          Thanks,
          sigpic

          Comment


            #6
            Re: Hiding a column in Grid

            Originally posted by chandran View Post
            I changed the code as given by you:
            with tmpl_srch_prm
            componentName = "srch_prm"
            if eval_valid("srch_prm") = .t. then
            with tmpl_srch_prm.field_info[16]
            if .TxtsrchAge = ">18"
            .Column.Hide = .t.
            else
            field_info[16].Column.Hide =.f.
            end if
            end width
            end if
            end with

            I am still getting the same error message
            I haven't checked the rest of the code but the bit in bold, since it already is within "with tmpl_srch_prm" it looks like it needs to just be field_info[16].

            Comment


              #7
              Re: Hiding a column in Grid

              Cripes I am going blind!!!

              It's end WITH not end WIDTH!

              Comment


                #8
                Re: Hiding a column in Grid

                I did correct the typo before testing.

                The error is after correcting the typo
                sigpic

                Comment


                  #9
                  Re: Hiding a column in Grid

                  Chandran,

                  You may be making this more difficult than it needs to be. Here is code that works in one of my pages. I'm showing the whole component generation so you will see how it fits. By the way, are you sure that variable srch_prm actually exists at the time you are testing for it?


                  Code:
                   
                  <%A5
                  Delete tmpl_Co_List
                  DIM tmpl_Co_List as P
                  tmpl_Co_List = a5w_load_component("Co_List")
                  with tmpl_Co_List
                  componentName = "Co_List"
                  '==== filter and hide columns with blank labels ====
                   .DBF.filter = "Li_Id=" + s_quote(session.Li.Id)
                  '==== get the user defined labels
                  dim tbl as P
                  tbl=table.open("[PathAlias.ADB_Path]\lists.dbf")
                  tbl.index_primary_put("Li_Id")
                  vRecNo=tbl.fetch_find(session.Li.Id)
                  if alltrim(tbl.Li_Co_Ul01)=""
                   field_info[4].column.hide=.t.
                  else
                   field_info[4].column.heading=alltrim(tbl.Li_Co_Ul01)
                  end if
                  if alltrim(tbl.Li_Co_Ul02)=""
                   field_info[5].column.hide=.t.
                  else
                   field_info[5].column.heading=alltrim(tbl.Li_Co_Ul02)
                  end if
                  tbl.close()
                  '==== end of filter and hide columns ====
                  end with 
                  delete x_Co_List
                  dim x_Co_List as p
                  tmpl_Co_List.request = request
                  tmpl_Co_List.session = session
                  tmpl_Co_List.response = response
                  tmpl_Co_List.serversetting = serversetting
                  x_Co_List = a5w_run_Component(tmpl_Co_List)
                  if x_Co_List.RedirectURL <> "" then 
                   response.redirect(x_Co_List.redirectURL)
                   end
                  end if 
                  ?x_Co_List.Output.Head.JavaScript
                  ?x_Co_List.Output.Head.CSS_Link
                  Pat
                  Pat Bremkamp
                  MindKicks Consulting

                  Comment


                    #10
                    Re: Hiding a column in Grid

                    Thanks for your detailed response. I had almost given up and exploring other options.

                    The web component is named: srch_prm.a5wcmp.
                    It is inserted in schl08_prm_compare.a5w

                    Srch_prm.a5wcmp has a search box where in the user keys in the age to get data applicable for that age. The data searched are presented in a grid.
                    I am attaching a copy of the a5w page code.

                    Please let me know if this information is enough.

                    I tried a grid linker and it works well. I am able to get the desired data. But they are in two grids, placed one above the other. If I am able to hide the lower grid if the age keyed in is >18 it is fine.

                    I can use any one of the above as long as it works.

                    Please help.

                    Thanks,
                    sigpic

                    Comment


                      #11
                      Re: Hiding a column in Grid

                      Chandran,

                      If the gridlinker approach works for you, then it might be the easiest way.

                      Say the parent grid is grid1 and the child is grid2

                      First, if your parent grid, Grid1, has a search component, then you can get the value typed into the search by looking at the AfterSearch event and getting the SearchDataSubmitted value of the age field. In the event, set a session variable equal to this value

                      session.age=SearchDataSubmitted.Age

                      Then in the page code, look for the section that displays the grid in the body of the page and use Xbasic to make that display or not

                      Code:
                       
                      <%a5 if val(session.age)>18 %>
                      <table>
                      <tr><td><%A5 ?x_Grid2.Output.Body.UpdateErrors %></td></tr>
                      <tr><td><%A5 ?x_Grid2.Output.Body.Grid_HTML %></td></tr>
                      </table>
                      <%a5 end if %>
                      Pat
                      Pat Bremkamp
                      MindKicks Consulting

                      Comment

                      Working...
                      X