SETPOSITOIN -how to use it?

arcull
Member Posts: 191
Hi, does anyone know how to proprerly use setposition on recordref which points to a table with one single field in primary key. A simple example would help much, cause I can't figure it out
RecR.SETPOSITION('04');does not work. RecR is of type RecordRef. Thanks for help.
0
Comments
-
Try something like this:
rer.OPEN(DATABASE::"Your Table"); fir := rer.FIELDID(nnn1); // where nn1 is the FIELDID of the first primary field fir.SETRANGE('04'); // if you have other primary key fields, you can repeat the both fir lines for each primary keyfield IF rer.FINDFIRST THEN BEGIN // you found the record END; CLEAR(fir); CLEAR(rer);
Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
Thanks for the work around kriki, but still I wonder how you can use it
since setposition can be applied to regular record variables as well. OK, maybe I can use this thread for the further issue that I encounterd (if that's not OK, I'll open a new one) and that is: How can I test the type of field which fieldref points to? I tried
IF FieldR2.TYPE = 'Code' THEN;
andIF FieldR2.TYPE = FieldR2.TYPE::Code THEN;
andIF FieldR2.TYPE = FieldR2.TYPE::'Code' THEN;
andIF FieldR2.TYPE = FieldR2.TYPE::"Code" THEN;
but it won't compile. Thanks for help again.0 -
IF format(FieldR2.TYPE) = 'Code' THEN;
is the winnig answer0 -
you can use setposition with the result of "GETPOSITION" function.
use a message to show what is generated...there is also a parameter...
anyway, another questiond:
I've this function, named FNTGetParRRRecordRef.OPEN(INTLocTableNo); RRRecordRef.SETPOSITION(TXTLocPosition); FRFieldRef := RRRecordRef.FIELD(INTLocFieldNo); MESSAGE(FORMAT(FRFieldRef));
and i call it with this:cu.FNTGetPar(cu.FNTGetTableNo(tbtest.TABLENAME),tbtest.FIELDNO(Name),tbtest.GETPOSITION(FALSE));
all the parameters are set correctly in the function, but the message is blank.
(maybe i'm doing a stupid error...)
tbtest = record customer
Please, no workarounds, because i need my parameters to be passed like the way i've done...when i'll finish the whole utility i'll post it0 -
Belias wrote:(maybe i'm doing a stupid error...)
i forgot to do find('=') after the setposition
here you can find my project
http://www.mibuso.com/forum/viewtopic.php?f=5&t=317630
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