Alpha DevCon 2018
Results 1 to 6 of 6

Thread: Dynamic Column Heading Question

  1. #1
    Member Tommy Thompson's Avatar
    Real Name
    Tommy Thompson
    Join Date
    Apr 2000
    Location
    Tennessee (Macgregor 26S)
    Posts
    451

    Default Dynamic Column Heading Question

    Is there a way to have dynamic column headings. By that I mean headings that are created from a table. I have a situation where the column heading needs to be the name of the employee, but that varies depending on what department they are in.

    Thanks in advance!
    Tommy Thompson
    Thompson Consulting Services
    Beautiful Kentucky Lake, Springville, TN 38256
    tommy@btthompson.com


  2. #2
    Moderator Steve Wood's Avatar
    Real Name
    Steve Wood
    Join Date
    Nov 2003
    Location
    Bay Area, California
    Posts
    8,789

    Default Re: Dynamic Column Heading Question

    Never tried it, but should be possible. Take any grid, look in the xbasic tab. Note the .Column.Heading = "mycolumnname". You should be able to override this property at runtime using xbasic in the A5W page for any given column.
    Steve Wood
    Join the ALPHA DEVELOPERS NETWORK
    There is no Cloud. It's just someone else's computer.
    Web - Mobile - Hosting - Products - Frameworks - Developer Resources
    AlphaToGo | IADN (100% Alpha Anywhere Websites)

  3. #3
    VAR Pat Bremkamp's Avatar
    Real Name
    Pat Bremkamp
    Join Date
    Apr 2000
    Location
    Oregon, USA
    Posts
    2,578

    Default Re: Dynamic Column Heading Question

    Tommy,

    The following code is from the head section of a page, not the component. It goes in the area where the component is processed. It does two things, it filters the grid based on a session variable, then looks at the label table. If the field is blank, it hides the column. If it isn't blank, then it sets the column label.

    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
    .
    .
    .
    Pat

  4. #4
    Member Tommy Thompson's Avatar
    Real Name
    Tommy Thompson
    Join Date
    Apr 2000
    Location
    Tennessee (Macgregor 26S)
    Posts
    451

    Default Re: Dynamic Column Heading Question

    Thanks guys. I think I can take it from here.
    Tommy Thompson
    Thompson Consulting Services
    Beautiful Kentucky Lake, Springville, TN 38256
    tommy@btthompson.com


  5. #5
    Member
    Real Name
    Drew R.
    Join Date
    Feb 2011
    Location
    Northeast TX
    Posts
    60

    Default Re: Dynamic Column Heading Question

    Did you ever get this working? I need to do the exact same thing.

  6. #6
    Member
    Real Name
    ferry kurniawan
    Join Date
    Apr 2015
    Location
    Jakarta
    Posts
    96

    Default Re: Dynamic Column Heading Question

    maybe you can use session variable.
    so in your heading column, <%a5 ?session.yoursessionvariable %>

Similar Threads

  1. Changing Value of Column Heading
    By Rhett Scott in forum Alpha Five Version 4
    Replies: 15
    Last Post: 08-11-2013, 10:05 AM
  2. Where is the browse property for column heading color when column selected?
    By rmcgaffic in forum Alpha Five Version 9 - Desktop Applications
    Replies: 2
    Last Post: 05-14-2009, 03:50 PM
  3. embedded browse center column heading
    By Bob Arbuthnot in forum Alpha Five Version 8
    Replies: 3
    Last Post: 03-02-2008, 02:18 PM
  4. Cannot delete Browser Column Heading in Vs 8
    By dpara01 in forum Alpha Five Version 8
    Replies: 0
    Last Post: 03-21-2007, 03:00 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •