why primary key is blank
vyanku
Member Posts: 791
In some tables like Company Information,Gen. Ledger setup the primary key these tables is blank.
Why it is always blank?
Why it is always blank?
0
Comments
-
usually in tables like this, you would insert only one record: inserting the record with a blank primary key, allows you to use
"TBCompanyInfo.GET" instruction without arguments for the "get" function.
I'm pretty sure that the use is this0 -
Yes, in a setup table the key is always left blank, because there can only be 1 record in a setup table.Debugging is twice as hard as writing code. Therefore if you write the code as cleverly as possible you are by definition not smart enough to debug it.0
-
Or better : there SHOULD only be 1 record in a setup table.azerty74 wrote:Yes, in a setup table the key is always left blank, because there can only be 1 record in a setup table.Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
wonder how this is handled in other products like AX, GP, Solomon, SAP, OracleCA Sandeep Singla
http://ssdynamics.co.in0 -
kriki wrote:
Or better : there SHOULD only be 1 record in a setup table.azerty74 wrote:Yes, in a setup table the key is always left blank, because there can only be 1 record in a setup table.
Have you tried to insert another records into the setup table? Does the SetupTable.GET still work if there are more than one record?Confessions of a Dynamics NAV Consultant = my blog
AP Commerce, Inc. = where I work
Getting Started with Dynamics NAV 2013 Application Development = my book
Implementing Microsoft Dynamics NAV - 3rd Edition = my 2nd book0 -
Yes, it works until there is one record with blank PK. If there is no record with blank PK, it will show you standard error.
Someone is using more records e.g. in Company Info table to store adresses and data for different offices and it is easy to modify the reports to get the correct address - just instead .GET you use .GET(MyOfficeCode) and you are done...0 -
I've seen the same use of the company info table.kine wrote:Someone is using more records e.g. in Company Info table to store adresses and data for different offices and it is easy to modify the reports to get the correct address - just instead .GET you use .GET(MyOfficeCode) and you are done...Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
This means you don't need to do any modifications to store different company logo for one company?
Just use companyinfo.GET if you want to use the standard logo. And use companyinfo.get('1') if you want logo for another company.Confessions of a Dynamics NAV Consultant = my blog
AP Commerce, Inc. = where I work
Getting Started with Dynamics NAV 2013 Application Development = my book
Implementing Microsoft Dynamics NAV - 3rd Edition = my 2nd book0 -
This means you don't need to do any modifications to store different company logo for one company?
Just use companyinfo.GET if you want to use the standard logo. And use companyinfo.get('1') if you want logo for another company.
Interesting Observation............ :whistle: :whistle:CA Sandeep Singla
http://ssdynamics.co.in0 -
Indeed, good idea, Alex!0
-
Alex Chow wrote:This means you don't need to do any modifications to store different company logo for one company?
Just use companyinfo.GET if you want to use the standard logo. And use companyinfo.get('1') if you want logo for another company.
Yes, for example. You just need to add the Primary key to the form and fill it by some code. Than you can store that code into some setup, to not use "Magic constants" in the code and you are done...0 -
So the next time when someone posts how to get 2 different logos in the same company, just refer them to this post.
Confessions of a Dynamics NAV Consultant = my blog
AP Commerce, Inc. = where I work
Getting Started with Dynamics NAV 2013 Application Development = my book
Implementing Microsoft Dynamics NAV - 3rd Edition = my 2nd book0 -
Or you just open new Picture (Picture 2) field in CompanyInfo and import the logo in there.0
-
tihomirjur wrote:Or you just open new Picture (Picture 2) field in CompanyInfo and import the logo in there.
Yeah, but you need to modify a standard Navision table to do this. Nothing wrong with it, but if you can get away with not modifying, then don't.Confessions of a Dynamics NAV Consultant = my blog
AP Commerce, Inc. = where I work
Getting Started with Dynamics NAV 2013 Application Development = my book
Implementing Microsoft Dynamics NAV - 3rd Edition = my 2nd book0 -
I've tried to use this method to apply different bank accounts according to the country or currency to a reminder letter.
As a complete novice I tried adding some CAL code to the report and came up with the following but I get a syntax error.
"Issued Reminder Header - OnAfterGetRecord"
IF "Currency Code" = '' THEN
CompanyInfo.GET('')
FormatAddrCodeunit.Company(CompanyAddr,CompanyInfo)
ELSE
IF ""Issued Reminder Header"."Country/Region Code" ='IE'THEN
CompanyInfo.GET('IRE')
FormatAddrCodeunit.Company(CompanyAddr,CompanyInfo)
ELSE
IF "Currency Code" = 'EUR' THEN
CompanyInfo.GET('EUR')
FormatAddrCodeunit.Company(CompanyAddr,CompanyInfo)
ELSE END;
Any tips gratefully received.
Thanks0 -
Some tables are supposed to have only one record, like the Company Information table. There is code in NAV all over the place that does a simple GET without a parameter, and if you enter more than one record into those tables, you might screw up the functionality without meaning to.
For your purpose (as I've already posted in the newsgroup) I would suggest a different solution for those different bank accounts. I'm thinking about adding a bank account number to the currency table, or a table that stores bank accounts for currencies. I do not think having multiple records in the Company Information table is the right solution for you.
Also, there are a number of issues with your syntax. I'd consider getting your NAV partner involved for some lessons in NAV development. Where I used to work we had a 1 day C/AL primer, and a 2 day reporitng class for absolute beginners.0 -
Thanks DenSter
I'm thankfully not daft enough to try this in the "Live" version and I was worried I'd have to make changes to every report which I think you've confirmed, as well as other unseen complications.
I'm not sure if we've got the licence to add tables and it wouldn't work with just currency, it needs to choose if currency blank, standard account, if country Ireland then Irish Bank or if Currency Euro and country Not Ireland then EURO account. I'll try and add a table and see how I get on.
I've done the report writer course but that barely touched CAL in the time we had and I'm wondering why I can't seem to find any resource to help with writing in CAL on the web, surely considering the cost of the software there should be at least a reference manual on Customer Source? I can't get another training day authorised at the moment!
I can't get on the newsgroup either - I guess that's whay you posted here too.0 -
From the Help menu, select "C/SIDE Reference Guide", in there you will find technical help. On your product disk, there is a folder called 'Doc', which contains the technical manuals. The one you're looking for is the Application Designer Guide, a file called 'w1w1adg.pdf'. Tons of information for you there
.
What I suggested is based on having no real sense of your requirement, just a suggestion of what I'm thinking based on what you posted in here. Your actual requirement is probably much more complex, and can be solved in more than one way.
It's not just syntax that I think you need some help with, but also some design help from an experienced consultant. Instead of trying to figure out HOW to do this, start with WHAT you need first, and discuss it with a NAV consultant. There might be a solution you haven't considered yet.0 -
Thanks for that, I've found the PDF, feel stupid for not looking on the initial disk, now to 2 weeks reading!0
-
Oh certainly don't feel stupid for not knowing something, that's being too hard on yourself. I didn't know about that folder until probably 2-3 years into my NAV developer career
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
- 250 Dynamics CRM
- 102 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

