Button to fill a table



I have created a array of structure in the cm3r file which has two character fields.  I have a table control on the Change form to fill this array structure and to make it easier for user to fill this table I like to add a button next to it which will trigger a fill to this structure.  The link is ready and the table can be filled successfully with the fill button but how can I create this button to start the fill process for this table?




  • If the primary goal is to have a Fill button closer to the Table object, then all you need to do is set the Button ID to 9 (GUI Option for the Fill button).


    1. Place the button on the form

    2. Populate the following Properties:

    Caption: Fill Table

    Button ID: 9

    3. Save changes to the form


    This button will function the same as the Fill button in the Toolbar. This means users will still need to place the cursor in the desired row before clicking the button.

  • Thanks for your comments


    I dont want users to need to place the cursor in the desired row before clicking the button.  How can I have the button place the cursor in the first empty row and trigger the link?




  • Verified Answer

    Create a Display Option with the following values:


    Screen ID: cm.view.display

    Modifies Record: true

    Action: do nothing

    GUI Option: 123

    Text Option: 123

    Bank: 1

    Default Label: Fill Table

    Condition: true


    Pre Rad Expressions:

    $L.custom.field=<name of the field used in the Fill>

    $L.custom.link=<name of the link record>


    $L.max=lng(denull(<structure name> in $L.filed)) 1


    RAD Application: us.link

    Parameter Names: record, name, string1, prompt, index

    Parameter Values: $L.filed, $L.custom.field, $L.custom.link, $L.custom.action, $L.max

  • Hi


    Thanks for your details of the display option.  I have created it and set the button ID on the form to 123 but the button is inactive on the form when testing this.  Is something missing to have it active so I can press it?




  • The "Fill Table" option itself should be displayed in the Toolbar or Options menu. Is it visible and does it work when selecting it?


    The most common issues related to an inactive button are the wrong Button ID and/or Display Option condition not evaluating to true.

  • It works now after restarting the SM client :)


    I enhanced this by adding these calc in the display option to fill into the row where the cursor is if its in the table else fill it in the end row.


    if nullsub(cursor.field.name(), "empty")#"<field in table to find or fill from>" then ($L.max=cursor.line(1)) else ($L.max=nullsub(lng(denull(<structure> in $L.filed)), 0) 1)


    then this in the link line to have it fill based on the value where the cursor is.


    if nullsub(cursor.field.name(), "empty")#"<field in table to find or fill from>" then ($L.idx=nullsub(cursor.line(1), 1);$c=$L.idx in <field in structure to base fill/find on> in $File;$query="<field in target file> like \"" $c "*\"") else ($query=true)


    Thanks very much for your help :)




  • I do have same requiremet to use fill function in table column..I tried your steps, but its not wiorking


    Can you please provide screenshots?