Frequently Asked Questions about Custom Properties

Visual LANSA Framework

Frequently Asked Questions about Custom Properties

How do I handle lists of custom properties programmatically?

All custom properties have a special ".Count" property associated with them.

This property tells you how many instances of a custom property currently exist.  

For example, suppose you have specified a Framework level custom property named STATES where the Administrator could choose one or more states from a fixed list.

To determine how many states were chosen for the current user you do this:  

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

          Withname(STATES.Count) Numericvalue(#Tot_State)

 

#Tot_State now contains how many entries are currently in the list of states.

If you then wanted get the state values from the list you might code this:

   Begin_Loop To(#Tot_sTate) Using(#Index)

 

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

               Withname(STATES) Instance(#Index) AlphaValue(#State_Code)

 

        Add_Entry << possibly some user visible list >>

 

   End_Loop

 

Why are the .COUNT values different by list type?

The .COUNT values returned to your program will vary by the type of custom property and the input method you have specified:

Type Input Method .COUNT Value / Comments

All

Single Value

Always 1

Alphanumeric, Numeric

List of Values

Always returned as the maximum number of entries allowed in the list. Your program needs to screen out which entries are "null" according to their values returned (e.g. blank or zero values may be considered to be "null" entries within your application). 

Boolean

List of Values

Not a valid custom property definition. You cannot define this type of custom property. 

Alphanumeric, Numeric

Fixed List

The number of entries actually selected by the administrator (or by default). The default behavior is to select the first entry in the default fixed list specified by the designer.  

Boolean

Fixed List

Always the maximum number of entries allowed in the fixed list. See next question as well.  

 

 

What are Boolean Fixed Lists For?

Boolean fixed lists allow multiple Boolean values to be consolidated into a single custom property. This is often easier and more efficient that coding multiple single Boolean values and it keeps the options together.

For example, imagine you need to store these custom properties:

User is allowed Jump

User is allowed to Hop

User is allowed to Skip

User is allowed to Run

You can do this by defining four Boolean single value properties (e.g. named JUMP, HOP, SKIP and RUN). They would appear to the administrator like this: 

To retrieve these properties programmatically you would do something like this:

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

          Withname(JUMP) BooleanValue(#CAN_Jump)

 

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

          Withname(HOP) BooleanValue(#CAN_Hop)

 

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

          Withname(SKIP) BooleanValue(#CAN_Skip)

 

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

          Withname(RUN) BooleanValue(#CAN_Run)

 

You can also do this by using a Boolean fixed list containing 4 entries (e.g. named ACTIONS). This would appear to the administrator like this: 

In this case each entry in the list represents a user state and would be programmatically accessed like this:

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

          Withname(ACTIONS) Instance(1) BooleanValue(#CAN_Jump)

 

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

          Withname(ACTIONS) Instance(2) BooleanValue(#CAN_Hop)

 

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

          Withname(ACTIONS) Instance(3) BooleanValue(#CAN_Skip)

 

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

          Withname(ACTIONS) Instance(4) BooleanValue(#CAN_Run)

What about Multilingual Systems?

Custom property captions, help text and fixed list user visible captions are all multilingual capable. You should be able to cause all aspects of your custom properties that are visible to administrators to be presented in the correct language by using the normal Framework translation procedures. 

Why aren't property names unique in the Framework?

There are 2 main reasons for this:

  • It means you can define a property like PRINTERNAME in both the Human Resources application and in the General Ledger application and have a different value specified for each application.
  • You can create search lists for a property. For example you could look for a property named PRINTERNAME at the business object level. If it was not found then look at the application level. If it was still not found you might finally look at the Framework level. 
My custom property does not seem to have the expected value?

Things that you should check first include:

  • The custom property has default values.
  • The Framework was saved and restarted since property was defined or changed.
  • You are signed on as an end-user (i.e. Using UF_EXEC or equivalent).
  • A level A (Application) property is being referenced by a command handler but there is no current application selected.
  • A level B (Business Object) property is being referenced by a command handler but there is no current business object selected.