Field Level code exists in two formats. First – there is code that is associated with fields objects in the data model that are used to gather and hold data content either entered by end users or calculated and created by Ninox. Second, there are objects within the table Data Model that consist exclusively of code and, as such, do not accept user data entry. These Formula Fields are used only to contain the results of the formulas (code blocks) that are assigned to them.

Code assigned to data entry fields can be used to if the field itself is visible in Form View and/or is writable (editable) when it is visible. Users may also assign code at the field level that acts as a Trigger – automating processes and/or operations immediately after the contents of the field has been edited. These field-level code options are displayed in the image below.

DISPLAY FIELD ONLY IF – The code block in this field must evaluate to a state of either True of False. If the evaluation is True, this field and it’s contents will be visible in form view to all uses with the necessary rights and privileges to access the table. if False, the field will remain invisible when the table is being viewed in Form mode. Note that the visible or invisible state of a field, as determined and controlled by this code block, does not affect the visibility of the field in any other view or mode within Ninox and, as such, this option should not be considered a security or data protection tool.

The ability for users to control the visibility of fields, dynamically during runtime, is a very powerful component of the Ninox user interface design toolset. This feature allows users to control what is and is not viewed on screen based on the contents of other fields or, more simply, based on their personal preferences. An example of dynamic control based on the contents of another field is displayed in the image below.

In the image above, the first example of the form view of the Real Estate Management system, the user has indicated that a fixed dollar amount ($) Rent Increase is scheduled. Because of this value selection in the Choice field ‘Rent Increase’, the Rent Increase Amount (numeric) and ‘Next Rent Increase’ (Date) fields are visible as they are relevant. Their relevance is determined according to the results of the evaluation of the code in each of their “Display Field Only If” code blocks. Those blocks (which are identical in both fields) evaluate the selected option in the choice field and evaluate to “True” if the selected option is “$” or ““ and, by default, False if the choice is not “$” or “”.

In the second image above, we see the result of the user selecting “None” as the value for the ‘Rent Increase’ field. In this case, there is no rent increase scheduled, the code block controlling the visibility of the ‘Rent Increase Amount’ and ‘Next Rent Increase’ date fields evaluates to False and, as a result, the fields are not displayed as they are not relevant.

Another powerful use of the ability to display and hide fields, in real time, at runtime, is to give the user direct control of their unique user experience. This is done by providing the user with a Yes/No field that they can use to toggle the visibility of certain fields on and off based purely on their preference. In the example depicted in the image below, the field highlighted in the red box – ‘Display Payment Receipts Ledger’ is a Yes/No field. When left unchecked (unselected), as it is below, it evaluates to a state (or condition) of False. Using the name of this field, by itself, as the criteria for determining the visibility of other fields on the form allows the user to decide what they do or don’t see at any given time and for any given record in a table.

The same record of the same table is displayed in the image below, but this time, the Yes/No field controlling the display of the cash receipts section of the Form view has been selected (checked) by the user. The result is that the entire cash receipts section of the Form view, including the embedded child table displaying cash receipts against the current invoice, appear.

The code inserted in all of the fields that appear below the Yes/No “Display Payment…” field is simply ‘Display Payment Receipts Ledger’; the name of the Yes/No field by itself. In Ninox, Yes/No fields are self-resolving meaning that the name of the field itself is a variable containing the value True or False based on whether or not the field has been selected by the user.

Revision: 3
Last modified: 2019/04/04

Zpětná vazba

Bylo to užitečné ?

Ano Ne
Označili jste toto téma za neužitečné...
Mohli byste nám, prosím, říct, proč ? Děkujeme !
Děkujeme za vaši zpětnou vazbu.

Sdělte nám váš názor na toto téma.

Prosím, nepoužívejte toto pro otázky k podpoře.
Pro zákaznickou podporu, nás kontaktujte zde.

Zveřejnit komentář.