recordref and recordID

txeriff
Member Posts: 515
Hi all,
i´d like to loop into the field table for all the option type fields and then retrieve the option values from each field.
Well, im trying to do something a bit complex, hope you can help. Here it goes:
Im getting confused with recordref and record id.
How do I set the recordref to a regular record type variable?
if you have a better idea to solve this, i´d apreciate your comments.
thanks! :thumbsup:
i´d like to loop into the field table for all the option type fields and then retrieve the option values from each field.
Well, im trying to do something a bit complex, hope you can help. Here it goes:
tobjeto is recordref type variable. tfield is the navision field table. ... TField.RESET; TField.SETRANGE(Type,TField.Type::Option); IF TField.FINDSET THEN REPEAT evaluate(vnotabla,format(tfield.tableno)); tobjeto.open(vnotabla); Tobjeto.SETPOSITION( ... ...
Im getting confused with recordref and record id.
How do I set the recordref to a regular record type variable?
if you have a better idea to solve this, i´d apreciate your comments.

thanks! :thumbsup:
0
Comments
-
RecordRef.RESET; RecordRef.OPEN(TAbleNo); //open a table RecordRef.CURRENTKEYINDEX(6); //select key no. 6 FiledRef := RecordRef.FIELD(26); //select filed no 26 FiledRef.SETRANGE(filterstring); setfilter on filed 26 IF RecordRef.FINDSET THEN do whatewer you want
You can also get RecRef by record ID
something likeRecordRef.GET(MyRecordID) //MyRecorID must be RecordID type variable
Hope this helps0 -
ppavuk wrote:
RecordRef.RESET; RecordRef.OPEN(TAbleNo); //open a table RecordRef.CURRENTKEYINDEX(6); //select key no. 6 FiledRef := RecordRef.FIELD(26); //select filed no 26 FiledRef.SETRANGE(filterstring); setfilter on filed 26 IF RecordRef.FINDSET THEN do whatewer you want
You can also get RecRef by record ID
something likeRecordRef.GET(MyRecordID) //MyRecorID must be RecordID type variable
Hope this helps
thanks, but not sure if its what i need.
im looping in a series of tables, so i dont know what key it is.
I would need to caption each value of any option type field, but if i loop into each row i would only see those values that have been used , not all the option values. Also note that it would be very slow, looping all the rows from a table to retrieve all the posible used option values.
I know it sounds a bit complex.0 -
The following code will message you all the optioncaptions in Table 27, adapt for your own use.
object : record Object
fields : record Field
recref : RecordRef
fieldref : FieldRefobject.setrange(type,object.type::table) ; object.setrange("company name",'') ; object.setrange(Id,27) ; if object.findset then repeat fields.reset ; fields.setrange(tableno,object.ID) ; fields.setrange(Type,fields.type::option) ; if fields.findset then repeat recref.open(object.ID) ; fieldref := recref.field(fields."No.") ; message('Table : %1, Field : %2, Optioncaption : ''%3''',object.id,fields."no.",fieldref.optioncaption) ; recref.close ; until fields.next = 0 ; until object.next = 0 ;
0 -
thanks a lot!
You wont believe but just found in another forum the solution0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K 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
- 320 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