Not having an active key?
navnoob
Member Posts: 26
Hi all,
I have a project where I do
inside a function inside my customer table.
When I run the customer card, it keeps telling me that
"The sales invoice header table does not have an active key that starts with the following field: Sell-to Customer No., Posting Date"
so my card cannot be run, so I thought maybe i have to add those fields to the keys inside the Sales Header Table, but still it keeps giving that message and my card not run. When i Remove the SETCURRENTKEY, then the card runs but not the result I want...
What mistake am I making?
Thank you.
I have a project where I do
SalesInvHeader.RESET;
SalesInvHeader.SETCURRENTKEY("Sell-to Customer No.", "Posting Date");
inside a function inside my customer table.
When I run the customer card, it keeps telling me that
"The sales invoice header table does not have an active key that starts with the following field: Sell-to Customer No., Posting Date"
so my card cannot be run, so I thought maybe i have to add those fields to the keys inside the Sales Header Table, but still it keeps giving that message and my card not run. When i Remove the SETCURRENTKEY, then the card runs but not the result I want...
What mistake am I making?
Thank you.
0
Answers
-
Are you sure that "SalesInvHeader" is a record on table 36:"Sales Header"?
It seems to me it is a record on table 112:"Sales Invoice Header".
And indeed, without SETCURRENTKEY it will work, but it will be slow. (On SQL, it might work fast anyway)Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
so:
The table that you refer to with your SalesInvHeader variable must have an active key that has the "Sell-to Customer No.", "Posting Date" in it. I don't believe that it matters in which order, but both fields must be in the key.0 -
It does matter!DenSter wrote:so:
The table that you refer to with your SalesInvHeader variable must have an active key that has the "Sell-to Customer No.", "Posting Date" in it. I don't believe that it matters in which order, but both fields must be in the key.
Putting a date as first field is in general not a good idea for performance.Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
gentlemen, so I took kriki advice and make sure the record variable is Sales header (36) and it is.
So i don't get it. the field sell-to customer no. and posting date does exists in the sales header (36) table and why I cannot use setcurrentkey on those field?
as I said before, I did try adding them to the key coulmns but it still doesn't work.
Any other suggestion or help please?
Thanks.0 -
Just to clarify
Is this still done? Did you add a new key or add a field to one?navnoob wrote:so I thought maybe i have to add those fields to the keys inside the Sales Header Table
And you’re sure SalesInvHeader (Name) is with Datatype (Record) is using Subtype (Sales Header)navnoob wrote:SalesInvHeader.RESET; SalesInvHeader.SETCURRENTKEY("Sell-to Customer No.", "Posting Date");
PS - Can you tell us what you are trying to evntually accomplish with this task?0 -
If the key exists. Is is also enabled?Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
Hi guys,
sorry, but it was a dumb dumb mistake, i reput the key in the sales invoice header table and it work. I remember doing it yesterday but i guess i was so stress out i might be wrong.
sorry for the trouble, but i thank you guys for the help.
so problem is solved
thanks thanks.0 -
Didn't say it is good for performance, just that it doesn't matter for the error message to come up as long as the two fields are both in an active key.kriki wrote:
It does matter!DenSter wrote:so:
The table that you refer to with your SalesInvHeader variable must have an active key that has the "Sell-to Customer No.", "Posting Date" in it. I don't believe that it matters in which order, but both fields must be in the key.
Putting a date as first field is in general not a good idea for performance.
0
Categories
- All Categories
- 75 General
- 75 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
- 610 NAV Courses, Exams & Certification
- 1.9K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 251 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions
