what is find set
dineshkumarcser
Member Posts: 34
what is findset...?
0
Comments
-
FINDSET (Record)
Use this function to find a set of records in a table based on the current key and filter. The records can only be retrieved in ascending order.
Ok := Record.FINDSET([ForUpdate][, UpdateKey])
Ok
Data type: boolean
If you omit this optional return value, a run-time error occurs if the system cannot find a record. If you include a return value, the system assumes you will handle any errors. Ok can have these values:
If Ok is...
It means the record set was...
TRUE
Found
FALSE
Not found
Record
Data type: record
If the record was...
Then...
Found
The system returns the record in Record and sets any FlowField in the record to zero. You must update them using CALCFIELDS.
Not found
A run-time error occurs, if you omitted the return value Ok.
ForUpdate
Data type: boolean
Set this to FALSE if you don't intend to modify any records in the set.
Set this to TRUE if you want to modify some records in the set.
If you set this parameter to TRUE, a LOCKTABLE is immediately performed on the table before the records are read.
UpdateKey
Data type: boolean
This only applies if ForUpdate is set to TRUE.
If you are going to modify any field value within the current key, set this parameter to TRUE.
Comments
You should only use this function when you explicitly want to loop through a recordset. You should ONLY use this function in combination with REPEAT .. UNTIL.
Furthermore, FINDSET only supports descending loops. If you want to loop from the bottom up, you should use FIND(‘+’).
The general rules for using FINDSET are:
• FINDSET(FALSE,FALSE)- read-only. This uses no server cursors and the record set is read with a single server call.
• FINDSET(TRUE,FALSE)- is used to update non-key fields. This uses a cursor with a fetch buffer similar to FIND(‘-’).
• FINDSET(TRUE,TRUE)- is used to update key fields.
Note
This function is designed to optimize finding and updating sets. If you set any or both of the parameters to FALSE, you can still modify the records in the set but these updates will not be performed optimally.
Example
The following C/AL code examples show how to use the FINDSET function:Example 1// Looping through a set without updating it. SalesLine.SETFILTER("Purch. Order Line No.",'<>0'); IF SalesLine.FINDSET THEN BEGIN REPEAT CopyLine(SalesLine); UNTIL SalesLine.NEXT = 0; END;
Example 2// Looping through a set and updating a field that is not within the current key. 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;
Example 3// Looping through a set and updating a field that is within the current key. 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;
You could have found this by clickling "Help->C/Side Reference" on your client. You only have to type in FINDSET on the keyword line.Fostering a homeless, abused child is the hardest yet most rewarding thing I have ever done.0 -
I have to agree with KYDutchie here, this ( and your previous 2, very basic questions) could have been found using the helpfile. Just a little question, did you have ANY training in developing in NAV ? Because i am suspecting you didn't. If not, do the development training first.You could have found this by clickling "Help->C/Side Reference" on your client. You only have to type in FINDSET on the keyword line.0 -
Check also this: http://www.mibuso.com/howtoinfo.asp?FileID=22Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 329 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions