Topic
  • 3 replies
  • Latest Post - ‏2014-02-25T15:52:07Z by GregM_dxler
kswathi2
kswathi2
2 Posts

Pinned topic How to create a column using a script?

‏2014-02-24T09:53:53Z |

Hello,

In the DXL script attached below, if we manually create a column 'Is a Req' in a module,and then run the script it gets populated. Instead I want the column to be created automatically when I run the script.

Please assist.

Thank You,

Attachments

  • MichaelGeorg
    MichaelGeorg
    53 Posts

    Re: How to create a column using a script?

    ‏2014-02-24T11:39:08Z  

    Hello kswathi2,

    first of all you should become aware of the difference between a column and an attribute.

    • Attributes contain information about a module or an object. They are stored in the module and contain the information permanently, regardless if they are currently displayed or not.
    • Columns on the other hand are stored as part of a view and display the information contained in some attribute or in case of Layout-DXL columns the information calculated by the Layout-DXL code.

    Anyhow, if you have the module open in edit mode and available as current module you can create a new attribute with the command:

    create object type "Text" attribute "Is a req"  //for a text attribute called "Is a req" (see also DXL Reference about AttrDef for more details.)

    So if you put this statement before the start of your loop the script should do what you want. 

    However your script does only set the information for all object at the time it is executed. If you want the column to be always up to date and show if currently an object "Is a req" you need to use a Layout-DXL column or a DXL Attribute. (See  DXL Reference "Layout DXL" and "Attribute Definitions" for more details.)

     - Michael

  • kswathi2
    kswathi2
    2 Posts

    Re: How to create a column using a script?

    ‏2014-02-25T09:43:46Z  

    Hello,

    I want to modify the above script such that when I run that script a column should be created "Is a Req" and it should verify the object text of every object for 'shall' and flag the result accordingly in 'Is a Req' column.

    Please assist.

    Thank You,

  • GregM_dxler
    GregM_dxler
    166 Posts

    Re: How to create a column using a script?

    ‏2014-02-25T15:52:07Z  
    • kswathi2
    • ‏2014-02-25T09:43:46Z

    Hello,

    I want to modify the above script such that when I run that script a column should be created "Is a Req" and it should verify the object text of every object for 'shall' and flag the result accordingly in 'Is a Req' column.

    Please assist.

    Thank You,

    At the beginning of your script, you can add a column by the commands:

    insert (column 1) //insert the column to the left of the second column

    attribute(column 1, Srcattr) //sets the column data to your attribute

    width(column1, 150) //specifies the width of the column so it is not skinny

    refresh currentModule //refresh so it gets displayed

    You might want to think if you want to first check to see if that attribute is already displayed in a column.

    Hope this helps,

    Greg