BPM Object attributes can be real or virtual. Defining an attribute as real means that the attribute contains an actual data value. When an attribute is defined as virtual, it means that it contains no data value, and is defined by its read and write access methods.
You create a virtual attribute the same way you create a real attribute, except that you select Virtual in the Storage Constraints section of the attribute editor. When you do this, Studio creates two methods
For example, if you designed a BPM Object to obtain weather data, you would likely include a temperature attribute. You could implement the temperature in degrees Celsius in an attribute called tempCelsius.
If you wanted to also handle the temperature in degrees Fahrenheit, you could implement a virtual attribute tempFahrenheit which would be implemented as follows:
return tempCelsius * 1.8 + 32
tempCelsius = (value - 32) / 1.8
amount as Decimal(2) amount = 0 for each item in items do amount = amount + item.amount end return amountIn this fragment of code, items is a group, and amount is a decimal value representing the cost of each item.
invoice.totalThere is no write method for the total attribute, nor would it make sense to have one (since by definition the total must equal the sum of the amounts), so you would not set it to any value in code.
weather.tempFarenheit = 70.7Remember that the 70.7 value will not be stored. Instead, when this line of code is executed, weather.tempCelsius will take on a value of 21.5.
display weather.tempFarenheitThe 70.7 value will be displayed.