0

Intro to "any" functions

Below is info on how we use the "any" data type here in our Ninox guidance, specifically in the syntax of our functions

"any" functions are a bit different

Values of the data type "any" as well as functions that use the data type "any" are slightly different from other functions.

For example, with a function like odd(number), you get an error message if you put anything other than a data type “number” in the brackets.

A function like text(any) accepts any data type and returns an appropriate result.

For functions that have "any" as a parameter, we use type casting and decide internally—within the function—how the specific parameter should be handled.

So you don't really need to worry about entering the right data type: an "any" function will always try to process the passed data as expected.

[any] as an array

There are some functions where you see "any" in square brackets [any] as a parameter.

This indicates that you need to pass an array of any data type.

For example, count[any] will count the elements of an array no matter what data types the elements hold.

any as return

If you see "any" as a return in a function, this usually means that the passed data type is also returned to you.

JSON for any

In some cases, a function requires or returns key-value pairs in curly brackets {...}.

Example

sendEmail({
    from: "sender@domain.com",
    to: "recipient@domain.com",
    subject: "Hello World!",
    text: "Some text"
})

See sendEmail

In the Ninox tutorial, we use JSON instead of "any" in these cases, even though the Ninox scripting editor calls these values "any."

We want to be more specific about these key-value pairs and typecasting and therefore use "any" in our Ninox guidance rather as a placeholder for all possible data types.

JSON objects are relevant, especially in our API.

See also

API introduction

Reply

null