Last month, I
was singing “Oh, oh, oh it’s Magic, you know! Never believe it’s not so!” with
250 of my colleagues in Jaffa, one of the oldest port cities in the world. Why?
Because it is
Magic! When I first got involved with the Magic Application Platform twelve
years ago there was a lot of talk in the industry about rules engines, business
rules editors, and the like. Today, you’re more likely to hear people discuss
cloud computing or service-oriented architecture than business rules engines.
But one of the features that puts the “Magic” in the Magic xpa Application
Platform is the Runtime Expression Editor. One of the reasons Magic employees believe so passionately in the solutions we bring to market is because we know that the productivity features offered are unparalleled. The Runtime Expression Editor is a great example of how our smarter technology works to help accelerate business performance.
When
running an application of the Magic xpa Application Platform, the end user can “zoom
in” on a range field by pressing the F5 function key, for example. This will
reveal the expression that is being used to determine what is being displayed
in the view for that range field. Using the pulldown and context menus an end user can edit
the expression on the fly. The Runtime Expression Editor can use numeric, string, “basic,”
date & time, and variable functions (see the partial lists below from the Magic xpi reference documentation).
If
an end user tries to use functions that are not in one of the groups mentioned
above, a message appears: “Function not allowed for use in expression.”
Not
every end user will have the aptitude needed to use the runtime expression
editor. However, more advanced users who
want to be able to adjust business rules at runtime in order to view different
results will find this a very powerful feature. Instead of rewriting the
application, the business rule can be modified at runtime allowing for various
kinds of what-if analysis. This takes the burden off of programming teams and gives power users the ability to work their Magic. After all "it's Magic, you know!"
Partial List of Functions Available in the Runtime Expression Editor
Numeric Functions
Multiplication Operator
Addition Operator
Subtraction Operator
Division Operator
Exponentiation Operator
String Functions
&
– Concatenates Alpha strings.
ANSI2OEM –
Converts data from ANSI to OEM.
ASCIIChr –
Converts a number to a corresponding character in the ASCII character set.
ASCIIVal –
ASCII value of a string character.
AStr – Applies a
selected format to a string value.
CRC – Calculates
redundancy check.
Del – Deletes
characters from a string.
DStr – Converts a date
or a date expression to a character string.
Fill – Repeats a
string.
Flip – Inverts a
string.
HVal – Returns the
decimal (base 10) value of a hexadecimal (base 16) number.
Ins – Inserts a string
in another string.
InStr – Searches for the
first occurrence of a string in another string.
Left – Extracts a
substring from the left.
Len – Returns the
defined length of an Alpha string.
Logical –
Converts a visual representation to a logical representation.
Lower – Returns a string
in lowercase.
LTrim – Removes leading
blanks.
MID – Extracts a
substring.
MlsTrans –
Returns the translation of a string.
mTVal – Converts a time
value in milliseconds from an Alpha string to a numeric value.
MVal – Converts a Magic
xpa number (with a specified length in bytes) to a number.
OEM2ANSI –
Converts data from OEM to ANSI.
Rep – Replaces a
substring within a string.
RepStr –
Replaces all occurrences of a defined substring with another substring in a
given source string.
Right – Extracts a
substring from the right.
RTrim – Removes trailing
blanks.
SoundX –
Compares homonyms.
StrBuild –
Replaces placeholders in a template string with string values.
StrToken –
Returns a token from a delimited string.
StrTokenCnt –
Returns the number of existing delimited tokens in a given string.
StrTokenIdx –
Returns the token index in a delimited Alpha string.
Translate –
Translates all logical names and nested logical names to their actual values.
TranslateNR –
Translates all logical names, including nested logical names, in a string to
their actual values.
Trim – Removes leading
and trailing blanks.
TVal – Converts a time
value stored as an Alpha character string to a numeric value.
UnicodeChr –
Converts a numeric value to its corresponding Unicode character.
UnicodeFromANSI – Converts an ANSI string to Unicode characters as
determined by the selected code page.
UnicodeToANSI – Converts a Unicode string to ANSI characters according to
a selected code page.
UnicodeVal –
Converts a Unicode character to its corresponding numeric value.
Upper – Returns a string
in uppercase.
Val – Converts an
Alpha character to a number.
Visual –
Converts a logical representation to a Visual representation.
Date and Time Functions
AddDateTime – Calculates the difference between two
Datetime values Adds a time interval to a Datetime value, which is represented
by Magic xpa Date and Time fields. The specified amount of years, months, days,
hours, minutes, and seconds are added to the current value of Date & Time,
and stored back into those two variables.
TVal - Converts a time value stored as an Alpha
character string to a numeric value, according to a picture.
Variable Functions
DataViewVars – Fetches the variables displayed on the form
from where the Print Data event was raised.
All Var functions use pointers to variables
in memory. Each variable in the memory has a unique number according to the
runtime tree. For example, if program A calls Program B, and in Program A there
are 3 variables and in B there are 2, then Variable A in program A receives the
number 1 in Runtime and variable A in program B receives the number 4. The Var
functions allow you to get information about dynamic variables.
VarPrev – Retrieves the original value of a variable,
based on a dynamic value representing a variable index within the Variable
list.