Not applicable condition

A conditional applicability of a field.  A field is "not-applicable" for a row of data, depending on the data of other fields.

Following JSON provides an ability to define the conditions for "not applicability" of a field per row.

ConditionMethodName (not yet implemented) provides implementation of complex conditions. The method’s request fields will be filled with values of the record’s fields (and possibly parent record fields).

A simple value-based condition can be set in "ConditionFields". One or more fields and its values can be specified as condition(s). If more than one condition is specified, it will be "AND" condition.  Any "OR" or other if/else condition should be implemented in the method specified at ConditionMethodName.

All conditions will be treated as “OR” condition if MatchAllConditions = false or null or not specified.

All conditions will be treated as “AND” condition if MatchAllConditions = true.

Not applicable field will not be shown when ShowValue = false.

Not Applicable field will be read-only(disabled) when ShowValue = true.

When a field is “not applicable” – you will see the following behavior.

  • The field will be grayed in the grid’s row (when AddressTypeId > 10 or AddressTypeId <=5)
  • In Edit window, when the AddressTypeId changes, if the “not applicable” condition is met, the field will be automatically hidden (“not applicable” condition is NOT met, the field will be shown).

For the sample, AddressTypeDescription is not all appliable when (AddressTypeId > 10  OR AddressTypeId <=5)

Example 1: Simple  one level sample, with one field

 Condition -  (address_type_id > 10 or address_type_id <= 5)

 [

  {

    "ConditionMethodName": null,

    "ConditionFields": [

      {

        "ConditionFieldName": "AddressTypeId",

        "ConditionFieldValue": "10",

        "ConditionOperator": ">"

      },

      {

        "ConditionFieldName": "AddressTypeId",

        "ConditionFieldValue": "5",

        "ConditionOperator": "<="

      }

    ],

    "MatchAllConditions": false,

    "ShowValue": false

  }

]

 Example 2: Two level with conditions on second level only, conditions on one field (AddressTypeId) only

 Condition  -  ( (address_type_id >= 5 and address_type_id <= 10) or (address_type_id = 15 or address_type_id = 20))

 [

   {

      "ConditionMethodName":null,

      "ConditionFields":[

         {

            "ConditionFields":[

               {

                  "ConditionFieldName":"AddressTypeId",

                  "ConditionFieldValue":"5",

                  "ConditionOperator":">="

               },

               {

                  "ConditionFieldName":"AddressTypeId",

                  "ConditionFieldValue":"10",

                  "ConditionOperator":"<="

               }

            ],

            "MatchAllConditions":true

         },

         {

            "ConditionFields":[

               {

                  "ConditionFieldName":"AddressTypeId",

                  "ConditionFieldValue":"15",

                  "ConditionOperator":"="

               },

               {

                  "ConditionFieldName":"AddressTypeId",

                  "ConditionFieldValue":"20",

                  "ConditionOperator":"="

               }

            ],

            "MatchAllConditions":false

         }

      ],

      "MatchAllConditions":false,

      "ShowValue":true

   }

]

 Example 3: Two level with conditions on each level, with two fields (AddressTypeAddressDomain, AddressTypeId)

 Condition -  (([address_domain]=’Customer’)) AND (([address_type_id]>=5 AND [address_type_id]<=10 OR  [address_type_id]=15 OR  [address_type_id]=20))

 [

  {

    "ConditionMethodName": null,

    "ConditionFields": [

      {

        "ConditionFieldName": "AddressTypeAddressDomain",

        "ConditionFieldValue": "Customer",

        "ConditionOperator": "="

      },

      {

        "ConditionFields": [

          {

            "ConditionFields": [

              {

                "ConditionFieldName": "AddressTypeId",

                "ConditionFieldValue": "5",

                "ConditionOperator": ">="

              },

              {

                "ConditionFieldName": "AddressTypeId",

                "ConditionFieldValue": "10",

                "ConditionOperator": "<="

              }

            ],

            "MatchAllConditions": true

          },

          {

            "ConditionFields": [

              {

                "ConditionFieldName": "AddressTypeId",

                "ConditionFieldValue": "15",

                "ConditionOperator": "="

              },

              {

                "ConditionFieldName": "AddressTypeId",

                "ConditionFieldValue": "20",

                "ConditionOperator": "="

              }

            ],

            "MatchAllConditions": false

          }

        ],

        "MatchAllConditions": false

      }

    ],

    "MatchAllConditions": true,

       "ShowValue": true

  }

]

Available Operators:-

MCL.GroupEntity.Operators = {
Equal: "=",
Contains: "Contains",
NotContains: "Not Contains",
Null: "NULL",
NotNull: "NOT NULL",
LessThan: "<",
LessThanOrEqual: "<=",
GreaterThan: ">",
GreaterThanOrEqual: ">=",
NotEqual: "!=",
NotLessThan: "!<",
NotGreaterThan: "!>",
StartsWith: "Starts With",
Like: "LIKE",
NotLike: "NOT LIKE",
Between: "BETWEEN",
NotBetween: "NOT BETWEEN",
In: "IN",
NotIn: "NOT IN",
NullOrEqual: "NULL OR EQUAL",
NullOrNotEqual: "NULL OR NOT EQUAL"
}; 

Example In AdventureWorks:

Url - https://web1.mclsystems.com/AWv32/#/Home

Menu Path – HumanResorces -> New Employee ->New Employee

Entities – AdventureWorks Entities

Table Name – NewEmployee

Not Applicable Field – Age

Goal – (EmployeeID = 1 AND DepartmentID=3) , if the condition is true,then need to hide the Age Field.

You can add NA json for Field Age under table (NewEmployee) fields as below:-

Output in UI (Grid):

You can see that NA condition is true(marked in red box).so Age Field got grayed(marked in green box) in grid’s row.

Output in UI (Form(Edit window)):

NA condition is true.so Age Field got hidden in form.