Hello!

Can you elaborate on your high-level use case:

  1. What data are you storing?
  2. What do you want to calculate?

Any particular reason you  decided to use globals instead of tables/classes? Article on how globals/tables/classes interact.

In general your task can be solved in two mainstream and one additional way:

  1. Store f. Every time a data point is inserted/updated we calculate and store f(datapoint). Advantage: fast querying and savings on CPU cycles as the calculation work is only performed once. Disadvantage: changing f requires recalculation and time, storage.
  2. Calculate f. Every time data point is accessed we calculate f. Advantage: zero costs to change f, we immediately get new results. No storage required. Disadvantage: potentially CPU intensive load.

Additionally if you need to just check a condition (i.e. that f>0) you may not need an f value as by applying functional analysis, you can solve the issue analytically if f is a continuous function.

Open role as an object (note lowercase):

set role = "%db_cachetemp"
set roleObj = ##class(Security.Roles).%OpenId(role)

Create required resource as an object:

set resouceObj = ##class(Security.Resource).%New()
/// set resource

Insert resource into the role and save the role

do roleObj.Resources.Insert(resourceObj)
set sc = roleObj.%Save()

And role has a new resource.

Invoke is the way to go.

ClassMethod CreateWebApp(pVars, pLogLevel, tInstaller) As %Status
{
    Set Namespace=tInstaller.Evaluate("${Namespace}")
    Do tInstaller.PushNS("%SYS")
    Do ##class(Security.System).GetInstallationSecuritySetting(.security)
    If (security="None") {
        Set cspProperties("AutheEnabled") = $$$AutheUnauthenticated
    } Else {
        Set cspProperties("AutheEnabled") = $$$AutheCache // Password
    }
    Set cspProperties("NameSpace") = Namespace
    Set cspProperties("IsNameSpaceDefault") = $$$YES
    Set cspProperties("DispatchClass") = "MDX2JSON.REST"
        Set cspProperties("UseCookies") = $$$YES
    Set tSC = ##class(Security.Applications).Create("/"_Namespace, .cspProperties)
    Do tInstaller.PopNS()
    If $$$ISERR(tSC) Throw ##class(%Installer.Exception).CreateFromStatus(tSC)
    Quit $$$OK
}

And invoke with

<RunInstall Class="MDX2JSON.Installer" Method="CreateWebApp"/>

IRISList is a wrapper over InterSystems IRIS $lb structure, and it supports these value types: Int16, Int32, Int64, bool, Single, Double, string, byte[], IRISList.

To be more specific the following datatypes are available.

  • ISO/IEC 8859{1 string. The remainder of the $LIST element is a string of ISO/IEC 8859-1 characters.
  • UNICODE string. The remainder of the $LIST element is a string of UNICODE characters in UTF-16 little endian format.
  • Positive integer. The remainder of the $LIST element is an unsigned integer in little endian order with high order zero octet truncated.
  • Negative integer. The remainder of the $LIST element is a negative integer in twos complement little endian order with high order #FF octet truncated.
  • Positive radix 10 number. The next octet is a signed char that serves as an exponent. That is followed by an unsigned integer in little endian order with high order zero octet truncated. The value of the number is integer × 10exponent.
  • Negative radix 10 number. The next octet is a signed char that serves as an exponent. That is followed by a negative integer in twos complement little endian order with high order #FF octet truncated. The value of the number is integer × 10exponent.
  • IEEE floating point number. Length must allow for either 4 or 8 (preferred) octet of data.

In C# Decimal can be constructed from {Int32, Int32, Int32, Boolean, Byte} and you can use GetBits method to retrieve these parts from Decimal   (docs).