RLD provides all of the basic operations that you will need for performing simple calculations. You can add, subtract, multiply, and perform a bunch of other operations.
But it gets very interesting when you perform these operations on data types that are different. For example, what happens when you add a number to text? Or even multiply text by a number?
This section first describes the basic operations and what they do. Then there is a big table that describes what happens when you mix data types for those operations. Fortunately, RLD does pretty-much what you would expect, so you may never need to consult this table. But just in case you are a power user who wants to do even more cool things with RLD, we've made this reference just for you.
Using basic operations in RLD is of the form:
There is an operation which we will call OP. And there is data for the operation on the left hand side and the right hand side of the OP, which we will call the LHS and RHS respectively.
For simple OPs, like addition, there is normally no reason to worry about what data is on the LHS and RHS, because the two numbers are just added together. But for subtraction, it is pretty important which side is which. In subtraction, the RHS is subtracted from the LHS, not the other way around.
The following tables list all of the available operations in RLD, along with a quick description of what they do.
OP | Name | Description |
---|---|---|
+ | Addition | adds the LHS and RHS together |
- | Subtraction | subtracts the RHS from the LHS |
* | Multiplication | multiplies the LHS by the RHS |
/ | Division | divides the LHS by the RHS |
Comparison operations allow you to compare data. For example, you can compare two numbers to
find out which one is greater.
Whenever a comparison is done, the outcome of the operation is either a one (1
) or zero (0
) meaning that
the comparison was true or false respectively.
OP | Name | Description |
---|---|---|
> | Greater than | evaluates to 1 if the LHS is greater than the RHS, or zero otherwise |
< | Less then | evaluates to 1 if the LHS is less than the RHS, or zero otherwise |
>= | Greater than or equal | evaluates to 1 if the LHS is greater than or equal to the RHS, or zero otherwise |
<= | Less than or equal | evaluates to 1 if the LHS is less than or equal to the RHS, or zero otherwise |
== | Equal | evaluates to 1 if the LHS is equal to the RHS |
!= | Not equal | evaluates to 1 if the LHS if NOT equal to the RHS |
Calculations are often used to determine if multiple comparisons are true. You can use these logical operations to string together comparisons or other bits of data.
OP | Name | Description |
---|---|---|
AND | Logical "AND" | evaluates to 1 if both the LHS and RHS are non-zero/non-empty |
OR | Logical "OR" | evaluates to 1 if either the LHS or RHS is non-zero/non-empty |
! | Inverse or "NOT" | evaluates to 1 if the RHS is zero or empty (only has a RHS) |
In addition to the operations above, RLD supports numerous functions for calculating interesting statistics and other values that you may want to extract from your data. This section details those functions and how they are used.
In general, a function has a function name and arguments to the function:
Sum()
Computes the sum of all of the given arguments, interpreting them all as numbers. Those arguments can be individual numbers, or arrays of numbers - even from a group-by.
Usage:
Sum(value,...*)value→At least one value must be supplied for the function. If more are supplied, they will be added to the sum.Valid data:tagNumbertext_fieldsTexttagNumber Arraytext_fieldsText Array...*→(optional) - Any number of additional arguments can be supplied.Valid data:tagNumbertext_fieldsTexttagNumber Arraytext_fieldsText Array
>
Returns:
tagNumber
>
Examples:
Sum(1,2,3,4) => 10
Sum(10,[8,28],5) => 51
>
Notes:
- For text arguments (or text arrays) the text is converted to a number if it can be, otherwise it is taken as a zero.
- Each item in a provided array is added individually to the sum.
Max()
Returns the maximum value in the arguments, or the arrays within the arguments.
Usage:
Max(value,...*)value→At least one value must be supplied for the function. If more are supplied, this function will look for a maximum value within those arguments too.Valid data:tagNumbertext_fieldsTexttagNumber Arraytext_fieldsText Array...*→(optional) - Any number of additional arguments can be supplied.Valid data:tagNumbertext_fieldsTexttagNumber Arraytext_fieldsText Array
>
Returns:
tagNumber
>
Examples:
Max(1,2,3,4) => 4
Max(10,[8,28],5) => 28
>
Notes:
- For text arguments (or text arrays) the text is converted to a number if it can be, otherwise it is taken as a zero.
Min()
Returns the minimum value in the arguments, or the arrays within the arguments.
Usage:
Min(value,...*)value→At least one value must be supplied for the function. If more are supplied, this function will look for a minimum value within those arguments too.Valid data:tagNumbertext_fieldsTexttagNumber Arraytext_fieldsText Array...*→(optional) - Any number of additional arguments can be supplied.Valid data:tagNumbertext_fieldsTexttagNumber Arraytext_fieldsText Array
>
Returns:
tagNumber
>
Examples:
Min(1,2,3,4) => 1
Min(10,[8,28],5) => 5
>
Notes:
- For text arguments (or text arrays) the text is converted to a number if it can be, otherwise it is taken as a zero.
Integer()
Returns the closest integer to the given number, using traditional rounding.
Usage:
Integer(value)value→A single value must be supplied. Others will be ignored.Valid data:tagNumbertouch_appButton
>
Returns:
tagNumber
>
Examples:
Integer(1.678) => 2
Integer(100.3) => 100
>
Notes:
- Numbers with a decimal of .5 and above rounds to the next higher integer. Numbers with a decimal below .5 round down, effectively stripping off the decimal.
Average()
Computes the average value of all of the given arguments, including arrays. See "Notes" for important information about arrays.
Usage:
Average(value,...*)value→At least one value must be supplied for the function. If more are supplied, they will be included in the average. See Notes below for important information about array argumentsValid data:tagNumbertouch_appButtontagNumber Arraytouch_appButton Array...*→(optional) - Any number of additional arguments can be supplied.Valid data:tagNumbertouch_appButtontagNumber Arraytouch_appButton ArrayReturns:
tagNumber
>
Examples:
Average(1,2,[5,6,7]) = 3
Average([5,6,7]) = 6
>
Notes:
- When using arrays in an average, each array is considered a "sub-average" and will count as _one item_ if there are multiple arguments. So
average(1,2,[5,6,7]) = 3
- If there is a single array argument, then the average is the average of the array.
average([5,6,7]) = 6
Median()
Finds the median value of the given array. This is the value that is in the middle of the set of values, where 50% of the data points have a value smaller or equal to the median, and 50% of the data points have a value larger or equal to the median.
Usage:
Median(array)array→A single array of values must be supplied for the function.Valid data:tagNumber Arraytext_fieldsText Arraytouch_appButton ArrayReturns:
tagNumber
>
Examples:
Median([1,6,7,8,20]) = 7
Median([1,6,7,8,20,30]) = 7.5
>
Notes:
- If no arguments are given, then this function returns zero.
- If the given array has nothing in it, this function returns zero.
- If the argument refers to anything *other* than an array, that thing is returned.
- If the array has an odd number of data points, the exact median data point is returned. If the array has an even number of data points, then the average of the two median data points is returned.
Frequency()
Counts the number of times that a particular value occurs within an array of values.
Usage:
Frequency(value,array)value→The value that should be counted within the array.Valid data:tagNumbertext_fieldsTexttouch_appButtonmy_locationPositionarray→A single array of values which will be searched forvalue
Valid data:tagNumber Arraytext_fieldsText Arraytouch_appButton Arraymy_locationPosition Array
>
Returns:
tagNumber
>
Example:
Frequency(100,[10,987,100,2,11,100]) => 2
>
Notes:
- If a single value is given for the
array
, it will be compared against the first, returning either zero or one.
- If the array is empty, zero is returned.
- If the type of items in the second argument doesnt match the first argument
Percent()
Returns a number representing the percentage of time that a particular value appears within an array of values. The value returned is a number between zero and one.
Usage:
Percent(value,array)value→The value that should be counted within the array.Valid data:tagNumbertext_fieldsTexttouch_appButtonmy_locationPositionarray→A single array of values which will be searched forvalue
Valid data:tagNumber Arraytext_fieldsText Arraytouch_appButton Arraymy_locationPosition Array
>
Returns:
tagNumber
>
Example:
Percent(100,[10,987,100,2,11,100]) => .3333...
>
Notes:
- You can multiply the return value by 100 to get a traditional "percentage".
- If a single value is given for the
array
, it will be compared against the first, returning either zero or one for 0% or 100%.
- If the array is empty, zero is returned.
- If the type of items in the second argument doesnt match the first argument
Normalize()
"Normalize" a value between zero and one by comparing it to the expected range for the value. For example, if a number is expected to be between 8 and 28, and the value is given as 10, the normalized value would be .10 . A multiplier can also be supplied, which will be used to multiply the normalized value, giving it some weight. This is often used when many normalized values are added together, where some of the values have more weight than others.
Usage:
Normalize(value,low,high,mult*)value→The value that you want to normalize. Normally it would be between thelow
andhigh
. A Text data value will be converted to a number.Valid data:tagNumbertext_fieldsTextlow→The low value of the range for normalization. Anyvalue
that matches thislow
causes a return value of zero. This should be lower than the givenhigh
. A Text data value will be converted to a number.Valid data:tagNumbertext_fieldsTexthigh→The high value of the range for normalization. Anyvalue
that matches thishigh
causes a return value of one. This should be higher than the givenlow
. A Text data value will be converted to a number.Valid data:tagNumbertext_fieldsTextmult*→(optional) - If a multiplier is given, the return value will be multiplied by that number. This has the effect of giving a weight to the data, particularly if this is added to other normalized data.Valid data:tagNumbertext_fieldsText
>
Returns:
tagNumber
>
Examples:
Normalize(10,8,28) => .10
Normalize(10,8,28,5) => .50
>
Notes:
- You can multiply the return value by 100 to get a traditional "percentage".
- If a single value is given for the second argument, it will be compared against the first, returning either zero or one for 0% or 100%.
- If the array is empty, zero is returned.
- If the type of items in the second argument doesnt match the first argument
Contains()
Search an array for a value, or multiple values. Returns true (1) if the array contains the ALL of the values given, false (0) otherwise.
Usage:
Contains(array,value,...*)array→The array that should be searched forvalue
. If a single item is given, it is treated like an array with that item as its only member.Valid data:tagNumber Arraytext_fieldsText Arraytouch_appButton Arraymy_locationPosition Arrayvalue→The value that you want to search for in thearray
.Valid data:tagNumbertext_fieldsTexttouch_appButtonmy_locationPosition...*→(optional) - You can specify multiple values. All of them have to be in thearray
for this function to return 1.Valid data:tagNumbertext_fieldsTexttouch_appButtonmy_locationPosition
>
Returns:
tagNumber
>
Examples:
Contains([3,0,10,11,1,2],3) => 1
Contains([3,0,10,11,1,2],3,12) => 0
Contains(['one','two','three'],'four') => 0
>
Notes:
- If the array is given as a single value (not an array) it is converted to a single-value array.
- See
ContainsAny()
, it is just like this routine but looks for ANY mention of thevalue
in the array, as opposed to ALL.
ContainsAny()
Search an array for a value, or multiple values. Returns true (1) if the array contains the ANY of the values given, false (0) otherwise.
Usage:
ContainsAny(array,value,...*)array→The array that should be searched forvalue
. If a single item is given, it is treated like an array with that item as its only member.Valid data:tagNumber Arraytext_fieldsText Arraytouch_appButton Arraymy_locationPosition Arrayvalue→The value that you want to search for in thearray
.Valid data:tagNumbertext_fieldsTexttouch_appButtonmy_locationPosition...*→(optional) - You can specify multiple values. ANY of them have to be in thearray
for this function to return 1.Valid data:tagNumbertext_fieldsTexttouch_appButtonmy_locationPosition
>
Returns:
tagNumber
>
Examples:
ContainsAny([3,0,10,11,1,2],3) => 1
ContainsAny([3,0,10,11,1,2],3,12) => 1
ContainsAny(['one','two','three'],'four','five') => 0
>
Notes:
- If the array is given as a single value (not an array) it is converted to a single-value array.
- See
Contains()
, it is just like this routine but looks for ALL of thevalues
in the array, as opposed to ANY.
Stddev()
Calculates the standard deviation of an array of numbers.
The array is treated as a SAMPLE of the data.
See StddevPop()
for the standard deviation of an entire population.
Usage:
Stddev(array)array→The array contains all of the samples over which the standard deviation will be computed.Valid data:tagNumber Arraytext_fieldsText Arraytouch_appButton Array
>
Returns:
tagNumber
>
Examples:
Stddev([9,24,31]) = 11.2398...
>
Notes:
- If the given array has nothing in it, this function returns zero.
- Use
StddevPop()
for the standard deviation of an entire population.
StddevPop()
Calculates the standard deviation of an array of numbers, treating the array as the whole population of data.
See Stddev()
for the standard deviation of a sample of the
population.
Usage:
StddevPop(array)array→The array contains all of the samples over which the standard deviation will be computed.Valid data:tagNumber Arraytext_fieldsText Arraytouch_appButton Array
>
Returns:
tagNumber
>
Examples:
StddevPop([9,24,31]) = 9.177...
>
Notes:
- If the given array has nothing in it, this function returns zero.
- Use
Stddev()
for the standard deviation of a sample of the population.
Every time you press a button on an Input Form, it creates an event - which is exactly the time that the button was pressed, expressed in milliseconds since the Unix epoch. For example, if you pressed a button at exactly midnight on January 12, 2023 the event would have the number 1673503200000. If you pressed the same button one second later, the number would be 1673503201000. Notice that the two numbers are 1000 milliseconds apart, or one second.
Because button presses (events) are times, it is very easy to calculate with them. Some of the calculations you can do are:
When you use buttons on an Input Form, RLD creates an array of events in the database. So if you pressed a button twice, the record (after you submit it), would have an array of 2 events associated with that button/field. This section details some very important functions for calculating with those arrays.
Delta()
The Delta()
functions are the powerhouse
functions for dealing with events.
Each takes two arrays of events (button presses) and creates a new array
of the times between the arrays.
The first array is the start time array,
and the second the end time array.
So, for example, let's say you have a Input Form for a game of some sort with a "Start" button and an "End" button. You press the Start button when a play begins, and the End button when it ends. And let's say that happens many times during a match.
Each of the buttons will create an array of Events when the Input Form is submitted. For example, the Start and End buttons could generate arrays as the following table. Note that the numbers used in the table are purposefully small to make it easier to understand. In actuality, the numbers are BIG (see above) because they represent times to the millisecond.
Start | End |
[ 5, 78, 105 ] | [ 20, 100, 122 ] |
Actual numbers in events are much bigger. | |
Smaller numbers make examples easier. |
Delta(start,end) |
[ 15, 22, 17 ] |
The Delta()
is used to calculate the time intervals between the
presses of the two buttons. In the example above, the Start button was pressed
at times 5, 78, and 105 (again, the actual numbers are quite different, these
small numbers are used to make this example easier). And the End button was pressed at
times 20, 200, and 122. The Delta()
function will look at the times
in the two arrays and calculate the difference between the two times.
So what happens if the person collecting data accidentally misses pressing the Start button once? Using the example above, let's say that they missed the second Start button press: 78.
Start | End |
[ 5, 105 ] | [ 20, 100, 122 ] |
Actual numbers in events are much bigger. | |
Smaller numbers make examples easier. |
Delta(start,end) |
[ 15, 80, 17 ] |
This version of Delta()
places the emphasis on the End events.
It assumes that you always want know how long it took to get an End event
even if a Start event didn't happen. So if a Start event is missing,
Delta()
assumes that the End of the previous event was the Start
of the next event. So in the example above, the 20 in the End events is assumed
to be the start of the second event, so the resulting array has 80 for the delta
of the second event.
But why is that an issue? Well, it would be nice if people entering data were perfect. But they're not. Sometimes the Start button didn't get pressed prior to the press of the End button. Hopefully, for every End there is a Start, and for every Start there is an End. But as a good data collection designer, you can't count on that.
Usage:
Delta(startArray,endArray)startArray→The array of "start" events (button presses).Valid data:touch_appButton ArrayendArray→The array of "end" events (button presses).Valid data:touch_appButton Array
>
Returns:
touch_appButton Array
>
Examples:
The numbers are really small in these examples so that they can be understood. In actuality, the numbers are quite big.
Delta([5,78,105],[20,100,122]) => [15,22,17]
Delta([5,105],[20,100,122]) => [15,80,17]
Delta([],[20,100,122]) => [20,80,22]
Delta([5,78,105],[100]) => [22]
Delta([5,78,105],[100]) => []
>
Notes:
- The resultant array will always have the same number of things as the End array.
- Take a look at
DeltaStrict()
for a different type of delta function that focuses only on button presses with both a Start and an End.
DeltaStrict()
The DeltaStrict()
is almost like the Delta()
function.
It's job is to calculate the time difference between the events in the Start array
and those in the End array, just like Delta()
.
It has the same arguments, and returns the same type of value.
But there is a big difference.
DeltaStrict()
will only consider those differences where there
is both a Start and End button press.
When there is a Start event missing, the associated End event will be ignored.
Likewise, when there is an End event missing, the associated Start event will
be ignored.
Using the same examples from
Delta()
above,
here is what DeltaStrict()
will calculate:
Start | End |
[ 5, 78, 105 ] | [ 20, 100, 122 ] |
Actual numbers in events are much bigger. | |
Smaller numbers make examples easier. |
DeltaStrict(start,end) |
[ 15, 22, 17 ] |
But, wait, that's the same as Delta()
!
Yup, in this case each Start had an associated End.
How about this one:
Start | End |
[ 5, 105 ] | [ 20, 100, 122 ] |
Actual numbers in events are much bigger. | |
Smaller numbers make examples easier. |
DeltaStrict(start,end) |
[ 15, 17 ] |
In this example, the Start event "78" was missing, so DeltaStrict()
eliminated it from consideration.
See the Examples below for more cases.
Usage:
DeltaStrict(startArray,endArray)startArray→The array of "start" events (button presses).Valid data:touch_appButton ArrayendArray→The array of "end" events (button presses).Valid data:touch_appButton Array
>
Returns:
touch_appButton Array
>
Examples:
The numbers are really small in these examples so that they can be understood. In actuality, the numbers are quite big.
DeltaStrict([5,78,105],[20,100,122]) => [15,22,17]
DeltaStrict([5,105],[20,100,122]) => [15,17]
DeltaStrict([],[20,100,122]) => []
DeltaStrict([5,78,105],[100]) => [22]
DeltaStrict([5,78,105],[100]) => []
>
Notes:
- The resultant array will always have the same number of things as the smallest of the Start or End arrays.
- Take a look at
Delta()
for a different type of delta function that focuses on the End events.
Combine()
Combine event arrays together, in the order that the events occurred. Note that this is slightly different from using addition. See the examples for more information.
Usage:
Combine(array,...*)array→At least one array must be supplied for the function. But combining a single array is rather uninteresting, two or more is better.Valid data:touch_appButton Array...*→(optional) - Additional arrays provided will be combined with all of the others and will be placed in event order in the array.Valid data:touch_appButton Array
>
Returns:
touch_appButton Array
>
Examples:
The numbers are really small in this example so that it can be understood.
In actuality, the numbers are quite big.
Combine([5,78,105],[20,100,122]) => [5,20,78,100,105,122]
You can use addition to add two arrays together, too. Note that the order
of the things inside the added array is the same order as each of the
arrays when put together.
[5,78,105]+[20,100,122] => [5,78,105,20,100,122]
>
Notes:
- Two Events with the same number will both be in the resultant array. However, having two events with the exact same event time is nearly impossible.
Count()
Counts the number of things in one or more arrays, returning the total for all arrays.
Usage:
Count(array,...*)array→At least one array must be supplied for the function. The number of things in the array will be counted and returned.Valid data:tagNumber Arraytext_fieldsText Arraytouch_appButton Arraymy_locationPosition Array...*→(optional) - Each additional array will be counted and added to the total.Valid data:tagNumber Arraytext_fieldsText Arraytouch_appButton Arraymy_locationPosition Array
>
Returns:
tagNumber
>
Example:
Count([5,78,105],[20,100,122]) => 6
Input forms allow you collect positions or points - through a Position Map. The Position Map can be used to make decisions, display paths, or even show heatmaps allowing visual analysis of the density of proximity of the points related to each other.
A Position Map is a transparent rectangle you can size to your desires, and lay on top of a picture if you want. When you first create a Position Map in an Input Form, it gives you a sizable rectangle with hash lines across the face. This lines are there for indication purposes only and won't actually be part of the Position Map when you use it.
The purpose of the Position Map is to gather touches (or clicks) on the Input Form, keeping track of where the user touched. Each one of these touches becomes a position or point on the Position Map.
On this Position Map, there are 2 points: (.25,.5) and (.9,.75).
Each point consists of an X and Y that are each between zero and one. This is an important point - even if the Position Map is wider than it is tall (or vise-versa) each of the X and Y points are between zero and one. We use a somewhat standard form for referring to these points of: (X,Y) where the X value is first, and the Y value is second.
Position Maps get very useful when you put pictures behind them. In this example, the user touched on the kitchen table, or (.25,.25) and on the master bedroom bed, or (.75,.75). Remember that the Position Map is on top of the picture. Since Position Maps are transparent, you can see right through them to the picture below, except for the dots representing user touches.
The Position Functions are very useful for running calculations based upon the user touches on the Position Map. For example, let say you want to run a calculation that effectively asks Did the user click on the kitchen table?
The first thing you must do is define the position of the kitchen table on the image you've attached to the Position Map. In the Position Map to the left, the kitchen table in the image is within the indicated rectangle.
Rectangles are defined by their upper left corner, in this case (.2,.15), along with the width and height, in this case (.1,.2). Note that you may want to plan ahead a bit for people with big fingers by defining a rectangle that is a little bigger than the table.
Rectangle()
Returns an array of positions representing a rectangle. This is used to create a "calculation area" for an input position map. This "calculation area" allows you to answer questions such as "how many clicks on the table?"
Usage:
Rectangle(x,y,width,height)x→The X coordinate of the Upper Left Corner of the rectangle. It is OK if this number is less than zero, that just positions the rectangle off of the position map. This is very useful for semi-circles (see below). Note that if this number is greater than one, then the rectangle is positioned completely off of the position map and will not have any effect.Valid data:tagNumbery→The Y coordinate of the Upper Left Corner of the rectangle. It is OK if this number is less than zero, that just positions the rectangle off of the position map. This is very useful for semi-circles (see below). Note that if this number is greater than one, then the rectangle is positioned completely off of the position map and will not have any effect.Valid data:tagNumberwidth→The width of the rectangle. This must be a positive Number.Valid data:tagNumberheight→The height of the rectangle. This must be a positive Number.Valid data:tagNumber
>
Returns:
my_locationPosition Array
>
Example:
In these examples, pretend that there is a field call
UserInput
that includes touches on the kitchen table, above.
Rectangle(.1,.2,.3,.3) => [(.1,.2),(.4,.2),(.4,.5),(.1,.5),(.1,.2)]
Inside(Rectangle(.2,.15,.1,.2),UserInput) => returns the user input points on the kitchen table
Circle()
Returns an array of positions representing a circle.
Just like with Rectangle()
this is used to create a "calculation area" for an input position map.
This "calculation area" allows you to answer questions such as
How many 3-point shots were attempted?
Usage:
Circle(x,y,radius,*aspect,*points)x→The X coordinate of the Center of the circle. It is OK if this number is less than zero or greater than one, that just positions the circle off of the Position Map, creating a semi-circle on the Position Map.Valid data:tagNumbery→The Y coordinate of the Center of the circle. It is OK if this number is less than zero or greater than one, that just positions the circle off of the Position Map, creating a semi-circle on the Position Map.Valid data:tagNumberradius→The radius of the circle. This must be a positive Number.Valid data:tagNumber*aspect→(optional) - Often, a Position Map will not be square, so you have to be a bit more precise when drawing a circle. Because the scale for a Position Map is between zero and one, independent of the actual width or height of the Position Map, you can easily get ovals instead of circles using this function. The*aspect
is the ratio of the width of the Position Map to its height. If not specified, this defaults to one.Valid data:tagNumber*points→(optional) - Unfortunately, the circle you get is not really a circle. Instead it is a multi-sided polygone that approximates a circle using the given number ofpoints
. By default there are 12 points (one every 30 degrees). And for most things, this works just great. If you want a more circly circle, you can increase the number of points. Your calculations will slow down, however.Valid data:tagNumber
>
Returns:
my_locationPosition Array
>
Example:
Circle(.5,.5,.25) => [(0.75,0.5),(0.7165,0.375),(0.625,0.2835),(0.5,0.25}),(0.375,0.2835),(0.2835,0.375),(0.25,0.5),(0.2835,0.625),(0.375,0.7165),(0.5,0.75),(0.625,0.7165),(0.7165,0.625),(0.75,0.5)]
Inside()
Returns an array of positions from a set of points
that fall inside of a given shape
.
This function can return none of the given points
,
all of the given points
,
or a subset of them, just depends upon which points lie within the given
shape
.
Usage:
Inside(shape,points)shape→A shape such as that returned byCircle
orRectangle
.Valid data:my_locationPosition Arraypoints→A set of points, probably from an Input Form, that the user has input. This function will use theshape
and determine whichpoints
lie inside that shape.Valid data:my_locationPosition Array
>
Returns:
my_locationPosition Array
>
Example:
Inside(Rectangle(.2,.15,.1,.2),UserInput) => returns the user input points on the kitchen table
NumberOf(Inside(Rectangle(.2,.15,.1,.2),UserInput)) => returns count of the number of points returned
Position()
Usage:
Position(x,y)x→A number representing the X part of a position. Must be between zero and one. If below zero, it will be treated as zero. If above 1, it will be treated as 1.Valid data:tagNumber
>
Returns:
my_locationPosition
>
Examples:
Position(.5,.5) =>
a position representing:(.5,.5)
Position(-10,100) =>
a position representing:(0,1)
PosX(Position(.2,.8)) = .2
PosY(Position(.2,.8)) = .8
PosX()
Returns a Number representing the X part of the given position.
Usage:
PosX(position)position→A single position must be supplied for the function.Valid data:my_locationPosition
>
Returns:
tagNumber
>
Examples:
PosX(Position(.2,.8)) = .2
PosY(Position(.2,.8)) = .8
PosY()
Returns a Number representing the Y part of the given position.
Usage:
PosY(position)position→A single position must be supplied for the function.Valid data:my_locationPosition
>
Returns:
tagNumber
>
Examples:
PosX(Position(.2,.8)) = .2
PosY(Position(.2,.8)) = .8
Now()
Get the current time in milliseconds.
Usage:
Now( )
>
Returns:
touch_appButton
>
Example:
Now() => 1704931767000
NumberOf()
Count the number of things in the single argument.
This is a limited version of Count()
,
you may want to use that one instead.
Usage:
NumberOf(array)array→One array must be supplied for the function. The number of things in the array will be counted and returned.Valid data:tagNumber Arraytext_fieldsText Arraytouch_appButton Arraymy_locationPosition Array
>
Returns:
tagNumber
>
Example:
NumberOf([5,78,105]) => 3
Compare()
A general-purpose comparison tool. Given 2 particular arguments for comparison, determine if they are equal, or one of them is greater than the other.
Usage:
Compare(a,b,LT,EQ,GT)a→The first argument sets the standard for the type of data that will be compared. The second argument will be converted to the first prior to doing the comparison.Valid data:tagNumbertext_fieldsTexttouch_appButtonmy_locationPositionb→The second argument will be compared to the first.Valid data:tagNumbertext_fieldsTexttouch_appButtonmy_locationPositionLT→Ifa
is less thanb
, then this routine will return the argument inLT
. Note that all of the argumentsLT
,EQ
, andGT
should be of the same type.Valid data:tagNumbertext_fieldsTexttouch_appButtonmy_locationPositionEQ→Ifa
is equal tob
, then this routine will return the argument inEQ
. Note that all of the argumentsLT
,EQ
, andGT
should be of the same type. If this argument is a different type thanLT
then it will be converted that that type before comparison.Valid data:tagNumbertext_fieldsTexttouch_appButtonmy_locationPositionGT→Ifa
is greater thanb
, then this routine will return the argument inLT
. Note that all of the argumentsLT
,EQ
, andGT
should be of the same type. If this argument is a different type thanLT
then it will be converted that that type before comparison.Valid data:tagNumbertext_fieldsTexttouch_appButtonmy_locationPosition
>
Returns:
The type of
LT
will be the type returned. The other two arguments will be converted to the same type asLT
if they aren't already the same type.
>
Example:
Compare(1,2,"hello","there","dude") => "hello"
Compare(2,2,"hello","there","dude") => "there"
Compare(2,1,"hello","there","dude") => "dude"
If()
A basic "if-then" function. If the first argument is zero, then the function will return the argument that is in the "false" position (argument 3). Otherwise the function will return the argument that is in the "true" position (argument 2).
Usage:
If(condition,true,false)condition→The first argument is the "condition" that is checked. If zero, thefalse
argument is returned, otherwise thetrue
is returned.Valid data:tagNumbertrue→If thecondition
is non-zero (true) then this argument is returned. It should be of the same type as the third argument.Valid data:tagNumbertext_fieldsTexttouch_appButtonmy_locationPositiontagNumber Arraytext_fieldsText Arraytouch_appButton Arraymy_locationPosition Arrayfalse→If thecondition
is zero (false) then this argument is returned. It should be of the same type as the second argument.Valid data:tagNumbertext_fieldsTexttouch_appButtonmy_locationPositiontagNumber Arraytext_fieldsText Arraytouch_appButton Arraymy_locationPosition Array
>
Returns:
The type of
true
will be the type returned. Thefalse
will be converted to the same type as thetrue
argument if they aren't already the same type.
>
Example:
if(1 == 1,"hello","there") => "hello"
if(1 == 2,"hello","there") => "there"