Skip to content
umangenius-logo
U Man Genius docs
  • Pages
    • Welcome
      • ninext-loupe
        Ninext documentation
        • ninox-logo
          Ninext APP
        • Installation
        • Update history
        • Uninstall
        • Popup ninext
          • Fields and Functions
          • Debug tracer
          • 🚧 Errors
          • Finder
        • 🚧 Edit field
        • Copy, paste, duplicate & delete
        • HTML helping functions
        • Native JS
          • Clipboard sample
        • Badges
        • View field event
        • Button event
      • ninox-logo
        Scripting tips & tricks
        • General Information
        • Var and Let
        • icon picker
          Functions
        • If Then else
        • For and while loops
        • select, where, from, to
        • Order By (or Order)
        • create, delete, and duplicate
        • JSON in Ninox
        • Arrays in Ninox
        • Undocumented functions in Ninox
        • Manipulating Record IDs in Ninox
        • Dynamic Choice & MultiChoice

Functions

Jacques TUR
This instruction allows the creation of a new method that can be either (restricted to the code where it is declared) or (by inserting it into Options/Global Functions).
The return value of the function, like all linear code, depends on the last instruction of the function (the one right before the end):
function InitB(initialValue : boolean) do
if initialValue then
"true"
else
"false"
end
end;

var b := InitB(true);

Parameter Types

The different parameter types that can be declared include: ​text, number, date, datetime, time, timeinterval, appointment, boolean, html, color, icon, email, phone, location, file, user, and any.

Using Table Names as Parameters

It is also possible to declare a parameter whose type is a table name. In this case, the parameter can be used as a record of the table:
function total(record : Invoice) do
record.'NET Total'
end;

total(first(select Invoice));

Handling Arrays with Functions

It is not possible to pass an array directly to a function. However, you can use a JSON object (any) for this purpose:
function myFunction(t : any) do
for i in t.array do
i
end
end;

var myArray := [1, 3, 5, 6];
myFunction({
array: myArray
});
Want to print your doc?
This is not the way.
Try clicking the ··· in the right corner or using a keyboard shortcut (
CtrlP
) instead.