AnalyticaLicenseInfo
Returns information about the current Analyica user license.
AnalyticaLicenseInfo(item)
Returns information about the license code that Analytica is using, according to the value of the «item» parameter.
- AnalyticaLicenseInfo(item: Text)
Possible values of «item»:
"Expiration"
: If the license has no expiration date, it returns 0. Otherwise, it returns the date. The date is an integer, which you can format to display as a date using the Number format dialog. If the license is being roamed, then the date that roaming expires is returned (and the license's expiration is not available)."PurchaserID"
: A number identifying the organization that the license was issued to."UserID"
: A number indicating the user ID; usually, the sequence order in which licenses were issued to the organization."Optimizer"
: True (1) or false(0), indicating whether the license includes the Analytica Optimizer."Beta"
: True or false, indicating whether the license is for a beta-test release."Educational"
: True or false, indicating whether the license is for educational use only."x64"
: True (1) if the license allows use of the 64-bit edition.- This may be set if you are using Analytica or ADE 32-bit from a license that allows 64-bit use. To test whether you are actually using the 64-bit edition, see AnalyticaPlatform.
These provide access to the Reprise license components for the current license. The Reprise user-guide describes these in greater detail, for those who are interested.
"RlmLicense"
: The RLM product license name"type"
: Reprise license type. May be "beta", "eval", "demo", or a comma-separated list of these."Customer"
"Contract"
"HoldTimeSeconds"
"HostId"
"IssuedDate"
"Issuer"
"MaxRoamDays"
"MaxShare"
"MinCheckoutSeconds"
"NamedUserMinHours"
"NamedUserCount"
"Options"
"Platforms"
"RoamingStatus"
: 1 if the license is being roamed, 0 otherwise."RlmServer"
: The host name, or port@host, of the RLM server (if using centralized license)."Share"
"SoftLimit"
"StartDate"
"TimeZone"
"Version"
"RlmLicenseStatus"
"RlmStatus"
"RlmErrorText"
"GoodOnce"
: Returns True if the license has ever been used successfully (i.e., will always be true since you are using it).
Finally, there are these calls for obtaining a license object:
"Checkout:name,ver"
: Checkout a product license from a reprise server. (see below)"AsObject"
: Returns the Analytica license as a license object.
These return a license object that displays as «License». This object can be passed as the second parameter to AnalyticaLicenseInfo, in which case the above items can be used to examine the internal information for that «License» object.
Checking Out Licenses
The AnalyticaLicenseInfo can also be used to check out a particular license. Models could do this to require that a user has a certain license in order to use a particular functionality within the model. (These licenses must be digitally signed with Lumina's ISV digital signature, which is something only Lumina can do). As with Reprise licenses in general, these licenses can be node-locked to a specific computer, or can be served from an RLM server and can even be floating licenses.
The item value of "checkout:..." does this. When the item is "checkout", the item text itself should contain the word "checkout" followed by a colon, followed by the license name. For example, the following would check out a license for the product Financial_tools version 1.2 (or earlier):
AnalyticaLicenseInfo("checkout:Financial_tools,1.2")
When this succeeds, it returns a license object, which displays as «License». When it fails, it halts execution with an error message text returned from the Reprise license manager. When searching for the license, it searches first for *.lic
files in the CurrentModelFolder(), which means you can install *.lic
files in the same directory as the model. If not there, it looks next in the Analytica install directory, and finally on any RLM server used by Analytica. Any *.lic
file can also specify an RLM host as well using the HOST keyword (see Reprise documentation). The license remains checked out as long as the «License» object lives (e.g., is cached in the result of a variable).
If you don't want a hard error to result, but just want to test whether the checkout was successful, you can include a third parameter to "checkout"
. Using "1"
will return Null on unsuccessful checkout, while using "2"
will return the actual reprise error text, e.g.:
AnalyticaLicenseInfo("checkout:Financial_tools,1.2,1) → «null»
AnalyticaLicenseInfo("checkout:Financial_tools,1.2,2) → "License server does not support this product (-18)"
There is another mechanism for using a Reprise license to protect a model's intellectual property, separate from the use of this function. See Model Licensing.
Uses:
Anti-piracy of Models
You can use this function to ensure that selected user-defined functions run only with Analytica licenses issued to your organization, or for a selected client company. Embed this line in the function:
IF AnalyticaLicenseInfo("PurchaserID")<>3197
then Error("This model is only licensed to run at Acme Inc.");
{ function body follows }
Where 3197 is the purchaser ID for your or your client's organization. Use "Hide Definition" (from the enterprise edition) and distribute a locked copy of the model, so other users cannot view or modify this code.
Suggestions
Suggest that options "Release", "Platform", and "Edition" be added as possible parameter values for AnalyticaLicenseInfo, replacing need for the system variables AnalyticaVersion, AnalyticaPlatform, and AnalyticaEdition. Also, if given no parameter AnalyticaLicenseInfo() will return a table containing all license info, indexed by names of info types listed above.
History
Introduced in Analytica 4.0.
Enable comment auto-refresher