4D v16.3Find in field |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v16.3
Find in field
Find in field
The Find in field command returns the number of the first record whose targetField field is equal to value. After calling this command, value contains the value found. This feature allows you to execute searches using the wildcard character (“@”) on Alpha fields and then retrieve the value found. Note: Due to this principle, you cannot use a parameter ($1, $2, etc.) in value because this would cause malfunctions in compiled mode. Similarly, if you pass a field in the value parameter, keep in mind that its value will be reassigned if the query is successful (the command Modified record, in particular, will return True for the current record of the table). This command doesn’t modify the current selection or the current record. Historical note: In earlier versions of 4D, the Find in field command was named Find index key and only worked with indexed fields. Beginning with 4D v11 SQL, this limitation was removed and the command was renamed. In an audio CD database, during data entry let’s assume that you want to verify the singer’s name to see if it already exists in the database. Because homonyms can exist, you don’t want the [Singer]Name field to be unique. Therefore, in the input form, you can write the following code in the [Singer]Name field’s object method: If(Form event=On Data Change) Here is an example that lets you verify the existence of a value: C_LONGINT($id;$1) Note the >= that lets you cover all cases. In fact, the function returns a record number and the first record is numbered 0.
|
PROPERTIES
Product: 4D HISTORY
Modified: 4D v11 SQL TAGS Trouver clef index ARTICLE USAGE
4D Language Reference ( 4D v16) |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||