How to Find First Primary Key From Table Id ?

Purvesh_Maisuria
Member Posts: 71
Hello Experts,
I want the List of First Primary Key from Table Ids, I Have All Table Ids, But do not able to find First Primary Key of those table,
I used object table to find table ids. If Any one have idea, give me hint, may be that small hint focus on my problem. Thanks in Advance.
Thanks & Regards.
Purvesh Maisuria.
I want the List of First Primary Key from Table Ids, I Have All Table Ids, But do not able to find First Primary Key of those table,
I used object table to find table ids. If Any one have idea, give me hint, may be that small hint focus on my problem. Thanks in Advance.
Thanks & Regards.
Purvesh Maisuria.
0
Answers
-
Use table Key, and where keys are Enabled, and than Clusterd = TRUE.
You have there Table No.0 -
Or create a variable of type RecordRef, and use KeyIndex to loop through the keys: http://lmsmfy.com/?q=keyindexNo support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)0
-
Hello Luc Van Dyck,
Thank U Very Much, I Have No Words, How Can I Say Thanks To U People.
Just Want To Say That U People Are "The Great". =D>
I Solve My Problem From Your Suggested Link. Hope U People Help & Support When We Are In Problem In Future.
Thanks & Regards,
Purvesh Maisuria.0 -
bekio wrote:Use table Key, and where keys are Enabled, and than Clusterd = TRUE.
You have there Table No.
Luc's method is the easiest one0 -
Hello Belias,
May Be U R Right, But I Didn't use That, I Write Some Code To Get First Primary Key Of Table.
===================Variables=================
Obj1 Record Object
PK KeyRef
RecRef RecordRef
i Integer
Field FieldRef
KeyString Text 1024
First Integer
===================Code====================
Obj1.RESET;
Obj1.SETRANGE(Type,1);
Obj1.SETRANGE(Obj1.ID,TableId);
IF Obj1.FIND('-') THEN
REPEAT
RecRef.OPEN(Obj1.ID);
PK:=RecRef.KEYINDEX(1);
FOR i := 1 TO PK.FIELDCOUNT DO BEGIN
Field := PK.FIELDINDEX(i);
IF First=1 THEN
BEGIN
KeyString:=Field.NAME;
First:=First+1;
END
ELSE
KeyString:=KeyString + ',' +Field.NAME;
END;
TableName1:=Obj1.Name;
TableKey:=KeyString;
RecRef.CLOSE();
KeyString:='';
UNTIL Obj1.NEXT=0;
===================Code====================
Thanks & Regards,
Purvesh Maisuria.0
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