Finds a set of records in a table based on the current key and
filter.
|
[Ok :=] Record.FINDSET([ForUpdate][, UpdateKey])
|
Parameters
- Record
-
Type: Record
If the record is found, then the record is returned in this
parameter and any FlowFields in
the record are set to zero. You must update the FlowFields by using
the CALCFIELDS Function
(Record).
- ForUpdate
-
Type: Boolean
Set this parameter to true if you want to modify any
records in the set; otherwise, set the parameter to
false.
If you set this parameter to true, then the LOCKTABLE Function
(Record) is immediately run on the table before the
records are read.
- UpdateKey
-
Type: Boolean
Set this parameter to true if you want to modify any
field value within the current key.
This parameter only applies if the ForUpdate parameter is true.
Property Value/Return Value
Type: Boolean
true if the record set was found; otherwise,
false.
If you omit this optional return value and if the record cannot
be found, then a run-time error occurs. If you include a return
value, then you must handle any errors.
Remarks
Example
This example shows how to use the FINDSET function to
loop through a set without updating it. This example requires that
you create a Record variable named SalesLine for the Sales Line
table and that you have a CopyLine function.
|
Copy Code |
SalesLine.SETFILTER("Purch. Order Line No.",'<>0');
IF SalesLine.FINDSET THEN BEGIN
REPEAT
CopyLine(SalesLine);
UNTIL SalesLine.NEXT = 0;
END;
|
This example shows how to use the FINDSET function to
loop through a set and update a field that is not within the
current key. This example requires that you create the following
variables.
Variable name |
Data type |
Subtype |
SalesLine
|
Record
|
Sales Line
|
DocumentType
|
Option
|
|
DocumentNo
|
Code
|
|
This example assumes that you have assigned values to
the DocumentType and DocumentNo variables and that you have a
GetNewLocation function, which returns a value that is a Code data
type.
|
Copy Code |
SalesLine.SETRANGE("Document Type",DocumentType);
SalesLine.SETRANGE("Document No.",DocumentNo);
IF SalesLine.FINDSET(TRUE, FALSE) THEN BEGIN
REPEAT
SalesLine."Location Code" := GetNewLocation(SalesLine);
SalesLine.MODIFY;
UNTIL SalesLine.NEXT = 0;
END;
|
This example shows how to use the FINDSET function to
loop through a set and update a field that is within the current
key. This example requires that you create the following
variables.
Variable name |
DataType |
Subtype |
SalesShptLine
|
Record
|
Sales Shipment Line
|
SalesLine
|
Record
|
Sales Line
|
|
Copy Code |
SalesShptLine.SETRANGE("Order No.",SalesLine."Document No.");
SalesShptLine.SETRANGE("Order Line No.",SalesLine."Line No.");
SalesShptLine.SETCURRENTKEY("Order No.","Order Line No.");
IF SalesShptLine.FINDSET(TRUE, TRUE) THEN BEGIN
REPEAT
SalesShptLine."Order Line No." := SalesShptLine."Order Line No." + 10000;
SalesShptLine.MODIFY;
UNTIL SalesShptLine.NEXT = 0;
END;
|
See Also