Calculated Fields - Logical

Calculated Fields - Logical




Calculated Fields                            Logical



Iif

Iif(FirstClauseFirstClauseTrueValue, ..., LastClauseLastClauseTrueValueFalseValue)

Returns either a value defined for the first Boolean condition that is True, or the last value if none of these conditions is True.
This function can accept any number of arguments.


EXAMPLE

Use ‘Customer Title’ column to create Male and Female data. If the Customer Title is ‘Mr’ set the output to be Male. If the Customer Title is not ‘Mr’ set the output to be Female.

Customer Title

Name

Mr

James

Mr

John

Ms

Sally

Mrs

Monica


Calculated Field:

Iif([Customer Title]'Mr''Male','Female')


RESULT:

Customer Title

Name

Calculated Field

Mr

James

Male

Mr

John

Male

Ms

Sally

Female

Mrs

Monica

Female











IsNull

IsNull(Value)

Returns True if the specified Value is NULL.


EXAMPLE

Use IsNull to check which row does not have data in the Name column:


ID

Name

1

James

2

Null

3

Sally

4

Monica


Calculated Field:

IsNull([Name])



OUTPUT


ID

Name

Calculated Field

1

James

False

2

Null

True

3

Sally

False

4

Monica

False







IsNull(Value1Value2)

Returns the second operand if the first operand is null, otherwise, the first operand is returned.


EXAMPLE:

Use IsNull to return ‘Name to be Inserted’ where a name does not exist.


ID

Name

1

James

2

Null

3

Sally

4

Monica


Calculated Field:

IsNull([Name], ‘Name to be Inserted’)



OUTPUT


ID

Name

Calculated Field

1

James

James

2

Null

Name to be Inserted

3

Sally

Sally

4

Monica

Monica
























IsNullOrEmpty


IsNullOrEmpty(String)

Returns True if the specified String object is NULL or an empty string; otherwise, False is returned.


EXAMPLE

Use IsNullOrEmpty to check which row does not have data in the Sale Price column:


ID

Sale Price

1

100

2

Null

3


4

200


Calculated Field:

IsNullOrEmpty([Sale Price])



OUTPUT


ID

Sale Price

Calculated Field

1

100

False

2

Null

True

3


True

4

200

False












ToBoolean

ToBoolean(Value)

Converts Value to an equivalent Boolean value.


EXAMPLE

Use ToBoolean to set a row to False when there is no data:


ID

Sale Price

1

100

2

Null

3

Null

4

200


Calculated Field:

ToBoolean([Sale Price])



OUTPUT


ID

Sale Price

Calculated Field

1

100

True

2

Null

False

3

Null

False

4

200

True















Combining Functions in Calculated Fields


If you want to create more complex calculated fields, you can combine different functions. 


Let’s create a calculated field which returns a text field that says ‘Free Product’ when the Sale Price is set to True and return a value of an empty space when the Sale Price set to False.


ID

Sale Price

1

100

2

Null

3

Null

4

200


We need to start with our Iif statement:


Iif( *condition* ,*when true* , *when false*)


We need out condition to return true and false values, rather than the content of the column we’re querying. 


For this we will use IsNull:


IsNull([Sale Price])


Now we know the two functions we need, let’s combine them:

Iif(IsNull([Sale Price])'True''Free Product','')


Our output should look like this:

ID

Sale Price

Calculated Field

1

100


2

Null

Free Product

3

Null

Free Product

4

200





    • Related Articles

    • Manual - Adest Web Retrieve

      Contents Introduction Connect to Adest Disconnect from Adest User Interface Ribbon Bar Adest Criteria Adest Grid (Results Grid) Group Results Filter Results Document Viewer Quick Update Buttons Invoice Actions Line Items Add a line item Delete a line ...
    • Manual - Adest Client Matching Module

           Contents Overview PO Matching Module Access Rights Accessing PO Matching Module from the Retrieve Module Enabling/Disabling Match Button Loading PO Matching Module: Matching Module Design/Layout Toolbar Action Group QUB Group E.G. Matching ...
    • Avidos Joins

      ​ Visual Explanation of Avido’s Joins                        Avido uses only two of the many SQL joins available; the Inner Join and the Left Outer Join. It can be difficult to imagine how your data is affected when applying these joins – so below is ...
    • Adest V5 User Manual

      USER GUIDE FOR ADEST V5.0 Index Scanning Indexing Retrieval Scanning Creation of a new batch folder To create a new batch folder, highlight the Public Batch and click into the Batch Name text bar. Type in the name of the new folder to be created and ...
    • Registration and Posting Process

      Registration and Posting Process Table of Contents Registration Registration Output Option One (ERP System Link) Option Two (Flat File Output) Registration Confirmation Option One (ERP System Link) Option Two (Flat file) Registration Error Option One ...