Error calculating Flowfields.

nofirm
Member Posts: 6
Hi there,
i am having problems calculating flowfields. in short: i have 2 companies (A and
.
Table 15 (G/L Account) has the property "DataPerCompany" set to "No".
Each company has its own set of G/L Entries (table 17 property "DataPerCompany" set to "Yes").
Now, i tried to do this:
I opened Company "A" and runned a form with the code:
"G/L Account".Reset;
"G/L Account".ChangeCompany('B');
"G/L Account".FIND('-');
"G/L Account".CalcFields("Balance at Date");
Message('Balance at Date for account %1, in Company B is %3', "G/L Account"."No.", "G/L Account"."Balance at Date");
This code was suposed to Message the user with a value of Company B but it returns the value of the currently opened company (A).
If you set DataPerCompany of table 15 to Yes this works fine, but i thought that calcfields and changecompany would do the work.
Hope you can help! Thanx!
i am having problems calculating flowfields. in short: i have 2 companies (A and

Table 15 (G/L Account) has the property "DataPerCompany" set to "No".
Each company has its own set of G/L Entries (table 17 property "DataPerCompany" set to "Yes").
Now, i tried to do this:
I opened Company "A" and runned a form with the code:
"G/L Account".Reset;
"G/L Account".ChangeCompany('B');
"G/L Account".FIND('-');
"G/L Account".CalcFields("Balance at Date");
Message('Balance at Date for account %1, in Company B is %3', "G/L Account"."No.", "G/L Account"."Balance at Date");
This code was suposed to Message the user with a value of Company B but it returns the value of the currently opened company (A).
If you set DataPerCompany of table 15 to Yes this works fine, but i thought that calcfields and changecompany would do the work.
Hope you can help! Thanx!
0
Comments
-
I must admit that I am not a 100% sure, but here goes:
If you do a changecompany on a table, then you don't change it on all tables (only for the one table), but maybe because you are calculating a flowfield (on a table that is has data per company, therefore would calculate it from the correct company data).
Since you have changed the data per company = yes for your G/L Account, the .changecompany has no effect?
regards,
gus0 -
flowfields will not work into other companies, even if you force a recordvariable into another company with CHANGECOMPANY. You will have to write code in the OnAfterGetRecord trigger of the form or something.
You could also add a function to the table with a return code. This return code can then be entered into a textbox on the form (I've seen this on a list form, not on a card form), so it basically behaves like a field of the table. I'm not sure if this will work though, I haven't tested it myself. Try getting a value from another company in that function and see if that correctly shows it on the form.0 -
hi Gus and Daniel,
first of all: flowfields do work with other companies.
If my tables 15 and 17 had the property DataPerCompany=Yes, everything would work ok!
if i run table15.changecompany(CompanyA), then, if i check the balance I can see the correct value for CompanyA.
the problem that I'm currently having is that table 15 has datapercompany set to No and if i run table15.changecompany(CompanyA), then, balance value for CompanyA is not right.
the problem may be in Navision's Core! It's a 100% guess!
Maybe when one runs "table.changecompany" Navision internal process checks:
If table.datapercompany=true then
' really changes company
' pointing to another physical table
' pointing to another SIFT tables
end if
Navision's Core should be:
If table.datapercompany=true then
' really changes company
' pointing to another physical table
' pointing to another SIFT tables
else
' no need to change pointer of table but:
' pointing to another SIFT tables
end if
Thanx for your support!
SS0
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