Chapter Contents

Previous

Next
Data Set Data Model: _setColumnAttributes

Data Set Data Model: _setColumnAttributes



Sets one or more attributes for a column


Syntax
Details
Examples
Example 1: Spin box list in a cell
Example 2: Editor pushbutton in a cell
Example 3: Combo box and editor pushbutton in a cell

Syntax

CALL SEND (object-id, '_setColumnAttributes', list-id);

Argument Type Description
list-id
N specifies the identifier of an SCL list that contains the new attributes for the column


Details

This list must contain at least a single character item with an item name of NAME. This value is required and must be a valid column name. Note that this method is indirectly delegated to the Data Set Model class, so column attributes for the Data Set Model class may be included in this list.

To set a single column attribute, use the _setColumnAttribute method.

Note: You cannot change the NAME, TYPE, LENGTH, COMPUTED, or MODIFIED attributes of a column.

A font list is acquired from the SCL FONTSEL function or a call to the _getDataFont method, the _getColumnAttribute method (retrieving the DATAFONT attribute), or a similar method that gets fonts for other objects.

Column Attribute Items
Item Type Description
'NAME' C the name of the column; must be 32 or fewer characters in length, and must be a valid SAS name, or nliteral if the validvarname option is specified.
'TYPE' C the type of the column:

'C' for character columns

'N' for numeric columns

'LENGTH' N the data length for the column.
'FORMAT' C the format name for the column; it must be appropriate for the column type
'INFORMAT' C the informat name for the column; it must be appropriate for the column type
'LABEL' C the label for the column:
'INITVALUE' C|N the initial value to use for the column when adding new records to the table; the type is the same as the data column
DSPROTECTED C 'Y' if the variable is derived via SQL

'N' if the variable is not derived via SQL

'DATFONT' N the identifier of an SCL list that contains the font to use when displaying the data
'LABFONT' N the identifier of an SCL list that contains the font to use when displaying the label
'REQUIRED' C 'Y' if a value is required for the column

'N' if a value is not required for a column

'PROTECTED' C 'Y' if the column is protected

'N' if the column is not protected

AUTOBLNK C
'HIDDEN' C 'Y' if the column is hidden

'N' if the column is visible

'EBCOLOR' C the background color when the column is in error
'EFCOLOR' C the foreground color when the column is in error
'LBCOLOR' C the background color for the column label
'LFCOLOR' C the foreground color for the column label
'DBCOLOR' C the background color for the column data
'DFCOLOR' C the foreground color for the column data
'JUST' C the justification format for the column:

'C' (center)

'L' (left)

'R' (right)

'N' (none)

'CAPS' C the capitalization for the column:

'Y' if the column sets entered values to UPPERCASE

'N' otherwise

'MINVALUE' C|N the minimum acceptable value for the column; the type is the same as the data column
'MAXVALUE' C|N the maximum acceptable value for the column; the type is the same as the data column
'ERROR' C 'Y' if the column is in error

'N' if the column is not in error

'DISPLAYLABEL' C 'Y' if the column label is displayed

'N' if the column label is not displayed

'COLUMN_WIDTH' C the width for the column in points. If the value of COLUMN_WIDTH is 0, then column width defaults to format-length EN spaces for character columns and format-length FG spaces for numeric columns.
'MODIFIED' C 'Y' if the column has been modified

'N' if the column has not been modified.

Notes: MODIFIED cannot be changed using the _setColumnAttribute or _setColumnAttributes methods.

This attribute's value is only meaningful when retreived by _getColumnAttributes during the model SCL's MAIN label.

Although using the MODIFIED attribute is convenient in some situations, such as where an OVERRIDE occurs, using a check for the MODIFIED attribute is expensive. Instead, column labels in model SCL should be used to handle modified columns where possible.

'COMPUTED' C 'Y' if the column is a computed column

'N' if the column is not a computed column

Note that COMPUTED cannot be changed using the _setColumnAttribute or _setColumnAttributes methods

'DISPLAY_WIDTH' N Maximum width of display
'DATACLASS' C the host control for a column:

COMBOBOX or SPINBOX

If no host control is desired, set to NONE.

'LABELCLASS'

'DATAATTRIBUTES' L the named list that defines the attributes for a column host control.

The attributes are:



'ITEMS' specifies a list of valid values for a column. This list will populate the host control.


'READONLY' specifies if a cell value is editable only through host control. Valid values are 'Y' | 'N' (default is 'N')


'TEXTCOMPLETION' specifies if text matching should occur as text is entered. Valid values are 'Y' | 'N' (default is 'Y')


'HONORCASE' specifies whether or not text completion (if active) is case sensitive. Valid values are 'Y' | 'N' (default is 'N').
'EDITOR' C the four-level name of the catalog entry that is opened as an editor when the ellipsis (...) button is selected in the cell
'EDITORATTRIBUTES' L the list of items sent to the editor. By default, the table passes the cell contents to the editor as the 'VALUE' list entry item.

If you wish to use a different entry item than the cell contents, specify a named item 'VALUE' on the editorAttributes list, and populate it with the desired values.




Examples

The following three examples illustrate how to place host controls in an active cell.

Example 1: Spin box list in a cell

This example creates a spin list with items 'one', 'two', 'three', 'four', and 'five' available on the spin list. It also protects the input field.

list = makelist();
rc = insertc(list, 'ONE', -1);
rc = insertc(list, 'TWO', -1);
rc = insertc(list, 'THREE', -1);
rc = insertc(list, 'FOUR', -1);
rc = insertc(list, 'FIVE', -1);
spinlist = makelist();
rc = insertl(spinlist, list, -1, 'ITEMS');
rc = insertc(spinlist, 'Y', -1, 'READONLY');
call notify(object-id, '_setColumnAttribute', column-name,
             'dataClass', 'SPINBOX');
call notify(object-id, '_setColumnAttribute', column-name,
             'dataAttributes', spinlist);

Example 2: Editor pushbutton in a cell

This example creates an editor pushbutton that will bring up 'SASUSER.EXAMPLE.EXAMPLE.FRAME' when it is selected.

call notify(object-id, '_setColumnAttribute', column-name,'editor',
            'SASUSER.EXAMPLE.EXAMPLE.FRAME');

Example 3: Combo box and editor pushbutton in a cell

This example creates both a combo box and an editor pushbutton. The combo box has the items 'red', 'green', 'blue', 'gray', 'white', and 'black' available on the drop-down list. The editor pushbutton will bring up 'SASUSER.EXAMPLE.CLRSELECT.FRAME' when it is selected. Text completion is on and is case sensitive.

list = makelist();
rc = insertc(list, 'RED', -1);
rc = insertc(list, 'GREEN', -1);
rc = insertc(list, 'BLUE', -1);
rc = insertc(list, 'GRAY', -1);
rc = insertc(list, 'WHITE', -1);
rc = insertc(list, 'BLACK', -1);
boxlist = makelist();
rc = insertl(boxlist, list, -1, 'ITEMS');
rc = insertc(boxlist, 'Y', -1, 'HONORCASE');
call notify(object-id, '_setColumnAttribute', column-name,
             'dataClass', 'COMBOBOX');
call notify(object-id, '_setColumnAttribute', column-name,
             'dataAttributes', boxlist);
call notify(object-id, '_setColumnAttribute', column-name,
             'editor', 'SASUSER.EXAMPLE.CLRSELECT.FRAME');


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.