LF: Find Value in DTI Column

This Ladder function finds a value in a column and writes the row index number into a data tag.

If the function finds a matching row, the row number is stored in parameter E, Result. If no row is found, E contains -1.

 

 

Parameter Name

Purpose

A

Data Table to Search

Select the Data Table you want to search.

B

Column to Search

From the struct, select the name of the column to search in.

C

Value to Find

This is the value you are searching for.
Assign a Data Tag to provide the value, or enter a number.

Note that the data type you are searching for must match the data type assigned to the column you search in.

D

Start Row for Search

This is the row from which the function begins to search.
This is the actual row index number, NOT an offset value.
Assign a Data Tag to provide the Row Number, or enter a number.

E

Number of Rows to Search

This determines the number of rows the function will search, from the index number in Parameter D.

Assign a Data Tag or enter a number.
Note that: supplying a value of '0" will cause the function to search the entire table.

F

Value Location: Row Index Number

If the value is found, the row index number of the row containing the value is written here.

A value of -1 means that the value was not found.

 

If the value in Start Row + Number of Rows equals or exceeds the number of rows in the table,
Result =-1 and an ERRNO code will be given.

 

Related Topics

Data Tables

Creating a Data Table

Data Table: Indexed (DTI)

LF: Write Row to DTI

LF: Read Row from DTI to Struct

LF: Insert Row to DTI

LF: Remove Row from DTI

LF: Clear DTI Row

LF: Copy Array to Column in DTI

LF: Copy DTI Column into Array

LF: Write value to DTI Column

LF: Load DTI File to PLC Data Table (SD)

LF: Store DTI to File (SD)

LF: Clear DTI