Fathom Reference > Fathom Operators, Functions, and Units > Other
cardIcon(card, suit)
cardIcon(cardNumber)
|
If there are two arguments, then the first (the value of the card) must be between 1 and 13 and the second (the suit) must be between 1 and 4.
If there is just one argument, it must be a number between 1 and 52.
This function can be used as a formula for the attribute in the panel of a collection inspector.
Example: cardIcon(11, 2) when used for the image formula will display the jack of diamonds in the collection.
See the Probability of a Pair simulation.
|
indexOfCategory(attribute)
indexOfCategory(attribute, value)
|
With a single argument, an attribute in the collection, this returns the index of the category corresponding to a case’s value for that attribute.
With a second argument, which should be one of the categories for the attribute, it returns the index of that category.
Examples: If the attribute sex has a category set {“M”, “F”} assigned to it, indexOfCategory(Sex) would give 2 for a case whose value for Sex is “F.” Similarly, indexOfCategory(Sex, "M") would give 1 and be independent of the case.
|
lookupValueByIndex(CollectionName,
AttributeName, index)
|
The first two arguments are strings and refer to the name of another collection and the name of an attribute in that collection. The third argument is the index of a case in that collection. The result will be the value of the attribute for that case in the collection with that name.
Example: In a document that has a collection States, lookupValueByIndex("States", "Name", 3) would give “Arizona” as the result.
Note: This function does not update dynamically, thus, in the example, if the name of the third state were changed to “AZ”, this would not be reflected as the result of the function until a recomputation were forced.
|
lookupValueByKey(CollectionName,
ReturnedAttrName, KeyAttrName,
keyValue)
|
The first argument is a string giving the name of a collection in the document. The second is a string giving the name of an attribute whose value is to be looked up in that collection. The third argument is a string giving the name of an attribute to be used as a “key” into the collection, and the fourth argument is the value to be matched with the key.
Example: lookupValueByKey("States", "Population", "State", "CA") would return 35000000, the result of looking up the population for California in a collection of states.
Note: This function does not update dynamically. Also, this is the function that (see Add Attributes from Another Case Table Using Table Join) creates for you automatically: one for each attribute brought over from the collection you drag from.
|
|