DESCRIPTION:

The select() function in Ninox enables users to define arrays automatically using the Ninox programming language. The select() function is used to extract a sub-set (or “selection”) of records out of a table containing multiple records. Sub-sets can be anything from, for example, all June Invoices extracted from the Invoice table to all students in the third grade extracted from the ‘All School Student Roster’ table.

The select() function, taken by itself and without modifiers, can also be used to create an array of records consisting of every record in a specified table.

SYNTAX

  • select ‘Table Name’
  • select ‘Table Name’.‘Field Name’

WHERE

  • select is the function keyword. This must be entered into the Ninox function editor in all lower-case characters
  • ‘Table Name’ is a valid reference to a table in the same database where the select() function is operating. While the path of a select() statement can transverse multiple tables in the same database, it can not cross over multiple database constructs.
  • ‘Field Name’ is an optional parameter used to define a specific field within the table schema of the table identified in the previous parameter. This optional parameter is used to extract the values of a specific field for all records included in the array returned by the select() statement. When a path is defined within the selectI() statement, the ‘Field Name’ is always the final parameter in the path itself.

Things to keep in mind when constructing this function:

  • As the results returned by the select() function is an array of records, keep in mind that the array can consist of all of the records in a table or some sub-set / sub-selection of all records in the table. To extract a sub-set / sub-selection of records the where modifier must be used in conjunction select statement as described in the Example section on this page.
  • Users many use the select() function to extract a defined group of records out of a table and into an array or they may drill-down to the field level and extract the contents of a specifically named field within the named table by including a ‘Field Name’ parameter.
  • When used in conjunction with the let statement, users can refer to an entire selection of records by simply referring to the single variable that was created using the let statement and subsequently assigned the results returned by the select() statement.
  • The parameters of the select() statement represent a path from the table in which the select statement exists, to the location where the content to be selected exists. This path may cross multiple tables in the same Ninox database.

EXAMPLE

  • select ‘Customer Invoices’ returns all records in the ‘Customer Invoices’ table
  • select ‘Customer Invoices’.‘Invoice Total’ returns an array consisting of all of the values of all of the ‘Invoice Total’ fields of all records in the ‘Customer Invoices’ table
  • select ‘Customer Invoices’ where ‘Invoice Total’ >= 1000 returns an array consisting of all records in the ‘Customer Invoices’ table where the value in the ‘Invoice Total’ field is greater than or equal to 1000.
  • select ‘Customer Invoices’ where ‘Invoice Total’ >= 1000 and ‘Invoice Total’ < 2000 returns an array consisting of all records in the ‘Customer Invoices’ table where the value in the ‘Invoice Total’ field is greater than or equal to 1000 and less than 2000.

SEE ALSO

Revision: 2
Last modified: 2019/11/10

Feedback

Was this helpful?

Yes No
You indicated this topic was not helpful to you ...
Could you please leave a comment telling us why? Thank you!
Thanks for your feedback.

Post your comment on this topic.

Please do not use this for support questions.
For customer support, please contact us here.

Post Comment