How to ignore "DataPerCompany" property?

MarharytaMykytenko
Member Posts: 53
I have a page that show info from table in which "DataPerCompany" property set to 'Yes'. But I have to get data from all companies for my page.
So how to get data from all companies but do not change "DataPerCompany" to 'No' ? may be it could be done by code or some other way
So how to get data from all companies but do not change "DataPerCompany" to 'No' ? may be it could be done by code or some other way
0
Best Answer
-
I have resolved this problem by adding this code to the OnAfterGetCurrRecord trigger
(variable "po_l" has Record data type and subtype is the table that have "DataPerCompany" property set to 'Yes' ):
comp_n:= Rec."Order Company Name";
po_l.CHANGECOMPANY(comp_n);0
Answers
-
You can't ignore it - that flag changes how the data is stored in the SQL database.
You are trying to display this in a page?
You'll have to make a new staging table that has DataPerCompany = false, load that table in a Company record loop in OnOpenPage, and make a new page that displays the staging table.Kyle Hardin - ArcherPoint1 -
kylehardin wrote: »You can't ignore it - that flag changes how the data is stored in the SQL database.
You are trying to display this in a page?
You'll have to make a new staging table that has DataPerCompany = false, load that table in a Company record loop in OnOpenPage, and make a new page that displays the staging table.
Thank you for the answer
So there are no way to do my task without creating new table?
(new table must contain data from my table, doesn't it?)
I know that it is possible to get data from all companies form table with DataPerCompany prop set to 'Yes'. But i don't know how I can produce this0 -
Create your new table with datapercompany=false, and add a new column called Company Name
You'll probably have to alter the primary key to include Company Name
Define your new page on top of that table - it can probably use this new table as a temporary table
Then do something like this in a codeunit
Company.FINDSET;
REPEAT
TablePerCompany.CHANGECOMPANY(Company.Name);
IF TablePerCompany.FINDSET THEN REPEAT
BufferTable.TRANSFERFIELDS(TablePerCompany);
BufferTable."Company Name" := Company.Name;
BufferTable.INSERT;
UNTIL TablePerCompany.NEXT = 0;
UNTIL Company.NEXT = 0;Kyle Hardin - ArcherPoint1 -
kylehardin wrote: »Create your new table with datapercompany=false, and add a new column called Company Name
You'll probably have to alter the primary key to include Company Name
Define your new page on top of that table - it can probably use this new table as a temporary table
Then do something like this in a codeunit
Company.FINDSET;
REPEAT
TablePerCompany.CHANGECOMPANY(Company.Name);
IF TablePerCompany.FINDSET THEN REPEAT
BufferTable.TRANSFERFIELDS(TablePerCompany);
BufferTable."Company Name" := Company.Name;
BufferTable.INSERT;
UNTIL TablePerCompany.NEXT = 0;
UNTIL Company.NEXT = 0;
Thank you for answer
Let me know what data type have "Company" variable0 -
A record for Table 2000000006Kyle Hardin - ArcherPoint1
-
I have resolved this problem by adding this code to the OnAfterGetCurrRecord trigger
(variable "po_l" has Record data type and subtype is the table that have "DataPerCompany" property set to 'Yes' ):
comp_n:= Rec."Order Company Name";
po_l.CHANGECOMPANY(comp_n);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