C/Front Setcurrentkey
carlo.myny
Member Posts: 8
I try to get the records of a table in a specific order.
So Setcurrentkey could help me do this.
There is a key defined in NAV but I do not know what to give to the SetCurrentkey as parameter.
1st parameter is the table, but the second is the key. But what shoukd be the value of the key. Must this bey the fieldnumber of the field on which the key in NAV is defined or the field number of the field in the overview of the keys.
example: If I look at the keys on a specific tabel there are for example 3 keys:
No.
Country
City
If I want city do I use 3 as Key value or do I use CF.FieldNo(Table, "City") as valu of the parameter Key.
I tried both ways but the records are not returned sorted as I want to.
So Setcurrentkey could help me do this.
There is a key defined in NAV but I do not know what to give to the SetCurrentkey as parameter.
1st parameter is the table, but the second is the key. But what shoukd be the value of the key. Must this bey the fieldnumber of the field on which the key in NAV is defined or the field number of the field in the overview of the keys.
example: If I look at the keys on a specific tabel there are for example 3 keys:
No.
Country
City
If I want city do I use 3 as Key value or do I use CF.FieldNo(Table, "City") as valu of the parameter Key.
I tried both ways but the records are not returned sorted as I want to.
0
Comments
-
Belias wrote:you should read the application developer guide before programming nav...
to answer your questio, press F1 in the C/AL designer and search "setcurrentkey"..you'll obtain the syntax.
It is not in NAV that I do this , it is in Microsoft office Word using VBA and the C/Front OCX. So the help of C/AL will not help me in this case.0 -
Are you sure F1 covers C/FRONT?Belias wrote:you should read the application developer guide before programming nav...
to answer your questio, press F1 in the C/AL designer and search "setcurrentkey"..you'll obtain the syntax.David Singleton0 -
i didn't read the title of the topic... :whistle: :oops:
it was strange, as i've seen that carlo joined mibuso in 2003...sorry.
P.S.: i've no experience with c/front, but i think you have to pass the table and the "cardinal" number of the key (i don't know if it starts from 0 or 1). About your example, if you want to use "city" key i think you have to pass (table,3(or 2))0 -
Belias wrote:i didn't read the title of the topic... :whistle: :oops:
it was strange, as i've seen that carlo joined mibuso in 2003...sorry.
P.S.: i've no experience with c/front, but i think you have to pass the table and the "cardinal" number of the key (i don't know if it starts from 0 or 1). About your example, if you want to use "city" key i think you have to pass (table,3(or 2))
I tried 3 already but no result. I tried 2 now but still no change in the sorting of the result.
Someone else who has experience with this.0 -
From the help I see that C/Front SetCurrentKey accepts an array with the key fields:
From the help file:Syntax Function SetCurrentKey(ByVal hTable As Long, ByVal Key As Variant) As Boolean hTable The handle to the table. Key The desired key or an empty variant. Example CF1.OpenTable hTable, 18 ' customer table longArray(0) = 1 ' field: "No." longArray(1) = 3 ' field: "Search Name" longArray(2) = 0 tmpVar = longArray tmpVar2 = CF1.SetCurrentKey(hTable, tmpVar) If VarType(tmpVar2) <> vbBoolean Then logWr "SetCurrentKey failed. It didn't return a boolean" End If CF1.CloseTable hTable
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
- 328 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
