Changecompany

Viji_Ganesan
Member Posts: 37
Hi All,
I am using changecompany function to get the records from other companies,
while insterting those in temp record variable, it keep says the record already exist.
say for "G/L Entry" table, if i get the data of other company thro changecompany and inserting it in the temp variable and display it. while inserting it throws error as
"G/L Entry Entry No. '1' already exists".
Kindly help me.
Regards,
Viji.
I am using changecompany function to get the records from other companies,
while insterting those in temp record variable, it keep says the record already exist.
say for "G/L Entry" table, if i get the data of other company thro changecompany and inserting it in the temp variable and display it. while inserting it throws error as
"G/L Entry Entry No. '1' already exists".
Kindly help me.
Regards,
Viji.
0
Comments
-
make sure your variable is temporary.0
-
Makes sense though doesn't it. You go into one company, changes are that G/L Entry number 1 exists. Then you go to another company, changes are that that company also has a G/L Entry number 1. If you are going to combine G/L Entry records from multiple companies into one variable, you need to make sure that the primary key of your temporary record variable includes the company name, or something else that signifies the identity of the company.0
-
Remember that CHANGECOMPANY only impacts the record variable for which it is called. All other record variables still refer to the current company.There are no bugs - only undocumented features.0
-
Be careful with changecompany. Only the Rec Variable on which you work is changed. So for example you make a validate on a field and in this field is source the source is fired on the actual company not on the changed company! Also never make validates on a temporary table if there is source in the onvalidate and there are other tables filled / modified.
so for your problem: You have the G/L as temp table and insert Account 123 for the first company. Now you change the company and there you will also insert in your temp. table the account 123 <- but this exist. so use a self defined table as temporary (for example you create your own with all needed fields so you can also use this table in other cases) and there you store company name and GL acc.
regardsDo you make it right, it works too!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