Field Lookups

  • In NF Tools, lookups are a means of loading data based on static or dynamic data.
  • These are usNFul for loading the data values for dropdown lists, radio button options.
  • Lookups can be of two types - static lookup or dynamic lookup.
  • Static Lookups are ones which have a fixed lookup data.
  • Dynamic Lookups usually have varying lookup data generally loaded from entity method.

Lookup methods

Lookup methods are of two kinds.

Simple Lookups: Simple Lookups that simply reads a key value of a field, and gets a description. These lookup data are cached for use by any page in any table for a field. A read method for such lookups will not have request table. Not having a request table indicates that it is an unconditional lookup table. Simple lookup can be specified at “Lookup Name” field in “Entity Fields” or at “Entity Table Fields” (method request or method response tables).

Restricted Lookups: Restricted lookups get possible list of values for a set of conditions. These lookups are used in request or response table fields.  A lookup for a field is restricted by values specified in other fields, as in picture below. The lookup method on “Parent Account No” field is uses values in “Account Type Id” and “Company Id” as parameter fields (request table fields). Restricted lookup data is recreated every time, when the Drop-Down List (DDL) is clicked. In the example below, when DDL on “Parent Account No” is clicked, the list of values is recomputed based values in “Account Type Id” and “Company Id” fields.

NF Usage

If a Restricted Lookup is specified in any response table field, a Simple lookup must be specified for the same field at Entity field. The Simple lookup will be used to populate lookup description in read methods, when data is shown in grid or form. If Simple lookup is not specified at the field level, the read method will not have description value, and the grid/form will show key (raw) value. Restricted Lookup will be used in Edit page (of response table).

The above design is based on performance reasons. In Read method, the description value is updated using cached lookup data in a single batch (in one SQL Statement) by looking at the key value and finding the description value. There is no need for any validation. If Restricted method is used to update description during read method, every record has to be updated in a loop, and that will slow down read method drastically.

When Simple Lookups is specified in any response table field, there is no need to specify at field level, as the same lookup will be used for read and edit pages.

Request table fields will use either simple or restricted lookups, when clicking the Drop-Down List (DDL). Request tables have only one record.

In this article

Lookup

Field's Description

  • Lookup Name Normally you will be setting a lookup for a field, at entity method table fields level. When setting a lookup at field level, it will be get created as shared lookup. When adding an lookup at the entity field level, you need to make sure that, that lookup’s entity method do not have a request table.
    Need to provide the lookup name. It should be unique for the application. Give a name that is easily identifiable for the use of that lookup..

  • Enable ? It’s Used to set whether that Entity object is enabled or disabled. When disabled, details of that entity object will not be get used.

  • Entity Name If the lookup going to use dynamic data, then need to use an entity method for fetching that dynamic data. Here need to pick the entity name in which that entity method is available.

  • Method Name Need to pick the entity method name from which the dynamic data for the lookup going to be fetched. Note: This option will be shown only when an entity name is selected from the “Entity Name” dropdown.

  • Response Table Name Need to select the correct response table name that is shown in the dropdown list.

  • View Name

    If there is a view name that can be used for the lookup, then it can be selected from the dropdown. Note: This option will be shown only when an entity name is selected from the “Entity Name” dropdown.

  • Data Text Field

    If the lookup going to use static data, then developer need to enter the correct data text field name from that static data.

    In the case of dynamic data, when the developer selects the entity name, entity method, and response table that need to be used for that lookup, fields that are available for that entity table will be get shown in a dropdown list. Need to pick the correct field name that need to be used as data text field.

    In the UI, when the user picks an item from that static/dynamic lookup, text field value for that selected item will be get shown for that lookup.

  • Data Value Field

    If the lookup going to use static data, then developer need to enter the correct data value field name from that static data.

    In the case of dynamic data, when the developer selects the entity name, entity method, and response table that need to be used for that lookup, fields that are available for that entity table will be get shown in a dropdown list. Need to pick the correct field name that need to be used as data value field.

    In the UI, when the user picks an item from that static/dynamic lookup, that selected items value will be used for that field.

  • Show Columns

    Using the Show Columns and Hide Columns option, developer can add settings of what all the fields that need to shown in lookup and what all fields that need to be hidden. By using this option, developer have the control to show only the needed fields that the end user will be interested to view in the lookup, and avoid showing unnecessary/unimportant fields.

    In the case of static lookup, for show columns, developer need to enter the columns that are needed to be rendered in the lookup and enter the columns that should not be shown in lookup, under hide columns. Note: When specifying multiple fields for show and hide, it need to entered separated by comma.

    In the case of dynamic lookup, for both show and hide columns, fields that are available there for that entity table will be get shown in respective dropdowns. Developer need to select those fields that need be shown and hidden for that lookup.

  • Hide Columns

    See above, Show Columns.

  • Lookup Column

    When the lookup is of static, then the developer needs to specify the structure -- fields of the lookup here. It need be provided in the following JSON format:

    [{"field":"Description","title":"Description"},   {"field":"Value","title":"Value"}]

    In the above example, lookup will be created with 2 columns, “Description” and “Value”.

    [{"field":"MenuCategory","title":"Menu Category"},  {"field":"ModuleName","title":"Module Name"}]

    In the above example, lookup will be created with 2 columns, “MenuCategory” and “ModuleName”.

    Note: This “Lookup Column” will be got when the lookup is of static. If entity method is used for the lookup, then this will not be got.

    See also: Data.

  • Data

    Here, for the static lookup, the developer need to provide the data that need to be used to bind the lookup. It needs to be provided in JSON format as follows:

    [{"Value":"M","Description":"Male"},{"Value":"F","Description":"Female"}]

    In the above example, 2 rows will be got bind to the lookup. Text as “Male” and “Female”. Value as “M” and “F”.

    Note: This “Data” will be got when the lookup is of static. If entity method is used for the lookup, then this will not be got.

    See also: Lookup Column.

  • Comments A little longer explanation of what that Entity object will do.

  • Allow Hierarchy?

  • Row Identifier Internal field.

  • Created User User who created that Entity object.

  • Created Date Date in which Entity object was created.

  • Updated User User who updated that Entity object lastly.

  • Updated Date Date in which Entity object was last modified.

  • Has Error? This is internal field. If there is any inconsistency/improper in the setting of the entity/entity table/entity field, or if the steps that need to be followed in creating the entity is not followed, then “Has Error” will be highlighted in red color. Clicking it will provide the details of what that error was, with suggestions to fixing the error.

Lookup Fields

The purpose of this tab is to provide a custom field label, and field description (that shows as tool tip), when a field is used with a lookup. i.e. when a field has “Editor Type” in (“DropDownList”, “CheckBoxList” or “RadioButtonList”).

When a field has one of these 3 editors, it can be set as “multi-select” or single select. DropDownList provides both single select and multi-select. CheckBoxList is meant for multi-select, and RadioButtonList is meant for single select.

A field may be used in one or more tables with one or more combination of Editor Type – single/multi-select.

The labels and description should appropriately change to show the meaning of the field.

For example, the field AccountNo - we may have field label: Account No, and description = A unique customer account number.

But when this is field is used with a DropDownList, we generally display the Company Name. So, it is not appropriate to label the field as “Account No” when a number is not displayed. The solution is to generically name the field as “Account”. If we used this field with multi-select combo – we should have label as, “Account(s)”.

Similarly, the description of the field should change when used with lookups.

Field's Description

  • Lookup Name Here it is internal primary/foreign key field.

  • Field Name Need to select the field for which need to provide the custom field label, and field description.

  • Data Value Field Label If a field has a lookup defined, the field may show description in UI instead of value. For example, a field "AccountNo" with lookup may show value in "Company" field (description value), instead of the value in field AccountNo. It will be easier to read the label as "Account" (instead of AccountNo). Such label would be a common denominator label to denote both AccountNo and Company. The common label will be stored in data_value_field_label, and will be shown for the field. If not specified, the label specified in the table-field or label specified at field level will be shown.

  • Value Field as Array Label

    The value specified here will be used when a lookup is used for a field which is an array of data_value_field field.

    See also: Data Value Field Label.

  • Data Value Field Description

    A short description of the using of “Data Value Field Label” for this field can be provided. This help description will be used when the lookup is set as single selection.

     

    See also: Data Value Field Label.

  • Row Identifier Internal field.

  • Created User User who created that Entity object.

  • Created Date Date in which Entity object was created.

  • Data Value Field Array Description A short description of the using of “Value Field as Array Label” for this field can be provided. This help description will be used when the lookup is set as multi-select. See also: Data Value Field Label, Value Field as Array Label.

  • Updated User User who updated that Entity object lastly.

  • Updated Date Date in which Entity object was last modified.