4.4.7 Virtual Field Considerations
Following are some important considerations when using virtual fields:
- More complex virtual fields can also be defined using 3GL code. The 3GL code will be written in RPG for the IBM i and in C for Windows (other platforms). If you are building applications which will execute on more than one platform, you must be very careful with 3GL code. For more information about creating virtual fields using 3GL code, please refer to Virtual Fields in the
- Remember to follow the field naming standards so that virtual fields will end in a 3 character suffix of "VIR". This will help developers identify a field as a virtual field. (Refer to Field Naming Standards.)
- Virtual fields are derived and are not real fields in the file. Virtual fields cannot be used as a key field for a physical file or a logical view. If you require fields for these purposes, you will need to make them into real fields as opposed to virtual fields.
- For the most part, LANSA treats the virtual fields like any other field in the file. You can add field and file level validation rules to a virtual field. If the file is being used for output, the validation rules should be specified on the virtual field and not the real field. You may encounter difficulties if you have validation rules on the real field but use virtual fields as before output to write to the file.
- A predetermined join field is a special type of virtual field. (Refer to 4.7 Predetermined Join Field Development.)
- You can also use trigger functions to create virtual fields. (Refer to 4.5 File Rules & Triggers Development.)
Also See
Virtual Field Definition in the
Field in File tab in the