Class Attributes

Class Attributes

Class attributes are the fields that provide context. When classes are saved in the database, each class is represented as a table in the database, and attributes as columns of the database table for the class.

 

 

Conventions and Rules for Attribute Names

Since attributes are represented as columns in the database table for the class, the following rules and conventions are for naming attributes are followed.

  • No spaces allowed
  • Maximum number of characters is 32
  • Use CamelCase Notation as a convention to take advantage of automated rendering when displaying the form
  • Names cannot start with numbers
  • Avoid special characters

 

Attribute Properties

A number of attribute properties are set when creating and changing class attribute definition.

name

Name of the attribute. Since attributes are represented as columns in the database table for the class, the following rules and conventions are for naming attributes are followed.

  • No spaces allowed
  • Maximum number of characters is 32
  • Use CamelCase Notation as a convention to take advantage of automated rendering when displaying the form
  • Names cannot start with numbers
  • Avoid special characters

format

The most important property aside from the name is the format of the attribute.

 

The five available types are String, Integer, Float, Date, and blob.

width

Width property is applicable and used when the format of the attribute is String. For example, a value of 12 for width (String format) means up to 12 characters can be saved in the field. As for the database column, the number 12 translates to VARCHAR(12).

 

type

 

display

 

read

 

write

 

update

 

query

 

dispwidth

 

Creating an Attribute

 

Attribute Naming Principles and Rules

 

 

Class Attribute Settings

 

When a new attribute is to be added, the following are the important things to be kept in mind.

  1. The preferred name of the attribute is CamelCase format (NameOfTheAttribute) and no special characters are allowed. Some rules on Attribute name include the following
    1. Attribute name can be up to 32 characters long
    2. Cannot have spaces
    3. Cannot have special characters
    4. Cannot start with digits
  2. The allowed Attribute formats include String, Integer, Float, Date and blob
  3. For String characters you can set the Width
  4. You can set the attribute to be required by selecting the type to the “rp”
  5. You can the display to be in the form of text, list, multilist, etc. depending on the data.

Attribute Specific Settings

Once you have an attribute created, you can change it’s settings by selecting it and then add SQL queries or js functions which can collate data from another class object an fill in the data fields.

 

You can use the “Add property” to add SQL queries or js functions that can fetch data from another class object and fill the data fields automatically.

 

Attribute Format and Combinations

Format

Type

Display

Dispwidth

String

p,rp

Text, area, list, multilist, password, url

Integer

p,rp

Text, area, list, multilist

Float

p,rp

Text, area, list, multilist

Date

p,rp

Text, area, list, multilist,url

Blob

p,rp

 

Attribute Properties

name

The name simply defines the name of the attribute. This can only be set at initial creation stage and cannot be edited later on. Also remember to use CamelCase format when creating names.

 

Format

The format can be used to set the content format of the attribute fields. The options are shown as follows.

 

 

display

The display option is used to set the display format for the attribute data. The options available are as shown below

 

Width

The width option can be used to set the field length limit of the attribute data field. This defaults at 32 but can be changed later on as well.

 

Read

Write
Update

 

Query

The query function returns the attribute in the form of a query sql search so data from one attribute can be mapped to another attribute in a different class object.

 

Listtype

The listtype is usually left at its default of “p”. This means that the attribute can be left blank and the process progression is possible. To have the attribute can be set to “rp” in case the field is to be mandatory. The process will progress only when the field is filled in that case.

 

dispwidth

This is used to set the max. visible char value for the attribute data field. This is usually set to null since we don’t want any of the values shown to be inconsistent or incomplete.

 

Select

Select can be used to select and map another Form’s data to be displayed in the Alternate class object. Here below, data from the Supplier Catalog Item form has been mapped to be displayed under the PR Item form.

 

 

selectcrit

Selectcrit is used to define the criteria on which data formats will be allowed to be mapped in from another form to be displayed in the Alternate Form. The below example shows one such criteria.

 

multilist

Multilist is used to set the ability to have multiple selections in a list of data for the Attribute data fields. When multilist is selected as the display parameter, multiple selections for values can be made for the data in the attribute field.

 

 

sourceattr

Sourceattr is used to map the exact attribute data field that is to be mapped in from another form and displayed onto another alternate form. In the below example, we have the SupplierPartNumber Attribute data from another Form being mapped to be displayed under Item in Purchase Requisition Form.

units

 

help

 

min

 

max

 

admin_update

 

 

 

List Attribute Properties

display – list, multilist

listsource – query,program,class

listtype – derived,actual,config

command –

 

Examples

Drop-down value selected is TransportationGroup from table  TTGRT. Description from table TTGRT is displayed on the screen

display – list

listsource – query

listtype – derived

command – select TransportationGroup,’::’,Description from TTGRT

 

Date Examples

default=TIME.Date” dispformat=“yyyy/MM/dd” display=“text” dispwidth=“10” format=“Date”

 

 

List Examples

command=“select Email,’::’,LastName,’ ‘,FirstName  from Usr where Role=’Assistant'” display=“list” listsource=“query” listtype=“derived”

 

command=“select Email,’::’,CONCAT(FirstName,’ ‘,LastName)  from Usr where Role = ‘Customer’ order by FirstName,LastName” multiselect=“Usr:EMail:FirstName,LastName:autocomplete” selcrit=“Role = ‘Customer'”

 

select Value,’::’,CONCAT(Value,’-‘,Description) from Family where Organization=’__Organization__’ order by Value asc

 

command=“select Email,’::’,LastName,’ ‘,FirstName  from Usr where Role=’Assistant'” display=“list” listsource=“query” listtype=“derived”

 

command=“Select CompanyCode from CompanyCode order by CompanyCode asc” display=“list” listsource=“query” listtype=“derived”

 

trans=“name:Collaboration”  listtype=“derived” listsource=“query” command=“select UID,’::’,CID from Collaboration where UID = ‘__CollabID__‘ order by CollID” copy=“-“ view=“Collaboration:UID” val=‘::None’/>

 

Multilist Examples

display=“multilist” admin_update=“+” dispwidth=“5” listtype=“derived” listsource=“com.*.*.*” command=“get*********”/>

 

 

Select Examples

 

 

Multiselect Examples

command="select Email,'::',CONCAT(FirstName,' ',LastName) from Usr where Role = 'Customer' order by FirstName,LastName" display="text" multiselect="Usr:EMail:FirstName,LastName:autocomplete" selcrit="Role = 'Customer'"

 

 

Float Examples

 

 

 

Integer Examples

 

 

String Examples

 

Javascript Function Examples

 

<Attr name=”SupplierID” display=”text” format=”String” nonchangeable=”+” query=”+” read=”+” type=”rp” update=”+” width=”64″ write=”+” jsfunc=”isUnique(this, ‘Supplier’, ‘SupplierID’)”/>