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

Grid

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

    Grid

    When building a grid does anyone know whether it is possible to have a field value f.eks a lookup value to be the row label?

    #2
    RE: Grid

    Dannie,

    Yes, Selwyn sent me the following by email. It is about column labels, but I'm sure row labels work the same way. I'm using it and it works well:

    "allowing for dynamic labels on components is not currently high on our agenda. however, having thought about it at little, i think that it is trivial for an experienced xbasic programmer to do themselves.

    the key to doing this is realizing that any property of a component can be overwritten before the component is executed.

    for example, the following is the code in the "head" section of a .a5w page that contains a component.
    all of the code shown in blue is code that is automatically inserted by the a5 genie when you insert a component on a page.
    (i am not showing the whole code block here .. just a portion of it).

    but not the line in red

    "%a5
    Delete Tmpl
    DIM Tmpl as P
    tmpl = a5w_load_component("dv")
    '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
    componentName = "dv"
    field_info[1].column.heading = "wow, this works"

    end with


    you will notice that i have overwritten the column.heading property for column 1 in the grid.
    when the grid displays, it will show 'wow, this works' and not 'customerId' (or whatever)

    using this concept, it is easy to write a function that takes two arguments:

    1. the name of an array (in this case the 'field_info' array) , and 2. a dot variable that contains information on which fields you want to override labels for.

    if you are not sure how to go about doing this, I could help you, but I suspect that your xbasic skills are up to this.

    The following is a followup email...

    one of the problems with the technique i described is that you override settings in the field_info[] array directly.
    so, if you change the order of the fields in the grid, the code you have to override settings will fail.

    below is a generalized technique that you can you to override settings by 'fieldname' rather than by field index.

    1. first, you would have to put this 'helper' function on your page. you could use an a5w_include() to include the helper function.

    function override_array_setting as v (input_a as p , override as c )
    dim count as n ; dim i as n; dim type as c;
    count = line_count(override)
    delete override_a
    dim override_a[count] as p
    override_a.initialize_properties("fieldname|property|value",override)
    count = override_a.first_empty() -1
    if count " 0 then
    for i = 1 to count
    indx = input_a.find(ut(override_a[i].fieldname),"ut(fieldname)")
    if indx " 0 then
    type = typeof(eval("input_a["+indx+"]." + override_a[i].property))
    eval("input_a["+indx+"]." + override_a[i].property) = convert_type(override_a[i].value,type)
    end if
    next i
    end if
    end function


    2. then, in the place where you override settings, you would use the following example xbasic

    dim override as c
    override = ""%txt%
    lastname|column.heading|LAST NAME
    lastname|column.hide|.t.
    customer_id|column.heading|Cust#
    %txt%


    'override settings in the field_info[] array with settings defined in the 'override' string
    override_array_setting(field_info,override)

    in the string, 'override' you are specifying the properties that you want to override using the syntax: fieldname|propertyname|newpropertyvalue

    you can test this out by running the following script:

    dim tmpl as p
    tmpl.ComponentName = "Component1"
    tmpl.ComponentType = "Grid"
    tmpl.DataSourceType = "DBF"
    tmpl.DBF.type = "Table"
    tmpl.DBF.table_name = "c:\program files\a5v6\samples\alphasports\Customer.Dbf"
    tmpl.DBF.filter = ""
    tmpl.DBF.order = ""
    tmpl.DBF.flags = ""
    tmpl.DBF.fieldmap = ""%str%
    CUSTOMER_ID,C,8,0=Customer_id
    FIRSTNAME,C,20,0=Firstname
    LASTNAME,C,20,0=Lastname
    COMPANY,C,32,0=Company
    PHONE,C,20,0=Phone
    FAX,C,20,0=Fax
    BILL_ADDRESS_1,C,40,0=Bill_address_1
    BILL_ADDRESS_2,C,40,0=Bill_address_2
    BILL_CITY,C,20,0=Bill_city
    BILL_STATE_REGION,C,20,0=Bill_state_region
    BILL_POSTAL_CODE,C,10,0=Bill_postal_code
    BILL_COUNTRY,C,20,0=Bill_country
    SHIP_ADDRESS_1,C,40,0=Ship_address_1
    SHIP_ADDRESS_2,C,40,0=Ship_address_2
    SHIP_CITY,C,20,0=Ship_city
    SHIP_STATE_REGION,C,20,0=Ship_state_region
    SHIP_POSTAL_CODE,C,10,0=Ship_postal_code
    SHIP_COUNTRY,C,20,0=Ship_country
    SHIP_SAME,L,1,0=Ship_same
    EMAIL,C,60,0=Email
    %str%

    tmpl.EditRegion.Grid.Top = ""%txt%
    %txt%
    tmpl.EditRegion.Grid.Bottom = ""%txt%
    %txt%
    tmpl.EditRegion.Grid.Left = ""%txt%
    %txt%
    tmpl.EditRegion.Grid.Right = ""%txt%
    %txt%

    tmpl.fields = 3
    DIM tmpl.field_info[tmpl.fields] as P
    with tmpl.field_info[1]
    fieldname = "Customer_Id"
    Scope = "Local"
    DisplayFormat = ""
    DisplayUnFormat = ""
    Type = "C"
    controltype = "Label"
    Label.InLineStyle = ""
    Column.Hide = .f.
    Column.Heading = "Customer id"
    Column.Sort = "Customer_id"
    end with
    with tmpl.field_info[2]
    fieldname = "Firstname"
    Scope = "Local"
    DisplayFormat = ""
    DisplayUnFormat = ""
    Type = "C"
    controltype = "Label"
    Label.InLineStyle = ""
    Column.Hide = .f.
    Column.Heading = "Firstname"
    Column.Sort = "Firstname"
    end with
    with tmpl.field_info[3]
    fieldname = "Lastname"
    Scope = "Local"
    DisplayFormat = ""
    DisplayUnFormat = ""
    Type = "C"
    controltype = "Label"
    Label.InLineStyle = ""
    Column.Hide = .f.
    Column.Heading = "Lastname"
    Column.Sort = "Lastname"
    end with
    tmpl.style_name = "Barbie"



    dim override as c
    override = ""%txt%
    lastname|column.heading|LAST NAME
    lastname|column.hide|.t.
    customer_id|column.heading|Cust#
    %txt%


    with tmpl
    override_array_setting(field_info,override)
    end with

    ui_msg_box("",tmpl.field_info[3].column.heading)
    ui_msg_box("","" + tmpl.field_info[3].column.hide)
    ui_msg_box("",tmpl.field_info[1].column.heading)


    function override_array_setting as v (input_a as p , override as c )
    dim count as n ; dim i as n; dim type as c;
    count = line_count(override)
    delete override_a
    dim override_a[count] as p
    override_a.initialize_properties("fieldname|property|value",override)
    count = override_a.first_empty() -1
    if count " 0 then
    for i = 1 to count
    indx = input_a.find(ut(override_a[i].fieldname),"ut(fieldname)")
    if indx " 0 then
    type = typeof(eval("input_a["+indx+"]." + override_a[i].property))
    eval("input_a["+indx+"]." + override_a[i].property) = convert_type(override_a[i].value,type)
    end if
    next i
    end if
    end function

    Pat
    Pat Bremkamp
    MindKicks Consulting

    Comment


      #3
      RE: Grid

      pat:

      thanks for supplying the answer to this question.

      Comment

      Working...
      X