Custom Properties

Visual LANSA Framework

Custom Properties

The Visual LANSA Framework uses a quite straightforward Framework, Application and Business Object model to define commercial computer systems.

You can extend this model by adding your own custom properties to the whole Framework, to Applications within it, or even to individual Business Objects:

The easiest way to understand the concept of custom properties is probably to consider this smattering of typical commercial application requirements:

  • Only some users of this application can delete contracts.
  • This user can display graphs upside down.
  • Some users can only view contracts signed in certain states.
  • All graphs presented should be rose colored. 
  • This user is restricted to working within this list of companies …
  • This user can view other employees at higher reward levels.
  • All reports should always be printed locally.
  • My preferred reporting currency is …. 
  • This system is installed in Japan?
  • This user normally works in Korea.
  • The URL of our company web site is www.mycompany.com (but it may change later). 
  • Does this system have a local Data Base?
  • The preferred date format for this user is
  • I need to associate an internal build number and date with my Framework to be shown in error situations. 

There are many ways to address these types of common requirements. One way is to add them as custom properties to your Framework

For example, take the simple "The URL of our company web site is www.mycompany.com (but it may change later)" requirement. To make the company web site URL a soft coded value in your Framework you would do the following:

As a DESIGNER

You would define a Framework level custom property named COMPANYURL. It would most likely be of type Alphanumeric with a maximum length of 256. It would not be changeable by on site Administrators and have a default value of www.mycompany.com.  

As a DEVELOPER

You would retrieve the value of custom property COMPANYURL into your programs to avoid hard coding of the company URL.

In both Windows and WAM applications you would retrieve the value like this:

   Invoke Method(#avFrameworkManager.avGetUserProperty) Atlevel(F) 

          Withname(COMPANYURL) AlphaValue(#COMP_URL) 

 

As an ADMINISTRATOR

You would have nothing to do. You may notice that every time you create a user profile it has a property called "Company Web Site" associated with it that has value www.mycompany.com but you would not be able to change it. Only the Framework DESIGNER would be able to change the value.

As a more complex example consider the "Some users can only view contracts signed only in certain states"  requirement. You could use custom properties to satisfy this requirement like this:     

As a DESIGNER

You might define an application level custom property named ALLOWSTATES. It might be defined as a fixed alphanumeric list like this:

Value Caption to Display to User

ALL

Allow all States

CA

California Only

NY

New York Only

MN

Minnesota Only

 

As a DEVELOPER

You would retrieve the value of ALLOWSTATES into your programs and use it to control how your program behaves.

In both Windows and WAM applications you would retrieve the value like this:

   Invoke Method(#avFrameworkManager.avGetUserProperty) Atlevel(A) 

          Withname(ALLOWSTATE) AlphaValue(#ALL_STATE) 

 

In either case #ALL_STATE would contain ALL, CA, NY or MN which you program would then use to control access to various contracts within your application. 

As an ADMINISTRATOR

When you define a user you can switch to the Custom Properties tab of the current user and select which states the user can view contracts from. You would have to select from a list that look like this:

These simple examples demonstrate the essence of custom properties. They of course have considerably more capability than this. For example you can specify the type as Alphanumeric, Numeric or Boolean and have multiple selection lists.

See also Frequently Asked Questions about Custom Properties and Things to be careful with when using Custom Properties.

Defining Custom Properties

When defining a new property these options are displayed:

Defined In

Caption

Sequence

Name

Help Text

Property Type

Maximum Decimals

Maximum Length

Uppercase

Input Method

Maximum Entries in List

Allow Multiple Selection

Value(s) can be changed by Administrator

Fixed / Default Values