"Special" Calcfield

fufikk
Member Posts: 104
Hi,
is it possible to have a calcfield in a table which would require to lookup a value from another table and multiply the result with value from source table?
For example: a vendor table has a field with value used for transport cost calculation (tcc), then an item table should contain a field with value of tcc*average item cost. Vendor Code for item is defined in the item table.
is it possible to have a calcfield in a table which would require to lookup a value from another table and multiply the result with value from source table?
For example: a vendor table has a field with value used for transport cost calculation (tcc), then an item table should contain a field with value of tcc*average item cost. Vendor Code for item is defined in the item table.
0
Comments
-
Have you tried to work this out in Data -scheme?
Sounds like a weird issue.
Have you tried to use the Method Average in the flowfields property?0 -
No, it is not possible to do this as a calcfield.0
-
The only way I can see it being done is using 2 fields on the Item Table, "Vendor Transport Cost" a flowfield to the Vendor table "Transport Cost" where No. = "Vendor No."
The other the Item Tables Normal field "Item Transport Cost"
Then on a form or report you can just do the calculation on the controls source expression.
"Item Transport Cost"*"Vendor Transport Cost"
Remember to use calcfields onAfterGetRecord.Analyst Developer with over 17 years Navision, Contract Status - Busy
Mobile: +44(0)7854 842801
Email: david.cox@adeptris.com
Twitter: https://twitter.com/Adeptris
Website: http://www.adeptris.com0 -
That would work. You probably should answer the question "is this data needed by an external application". If so, things become a little more tricky.
Othwerwise, I encourage developers to create a function to return the value which insures that there would only ever be a single definition of this within the system.
If placed in the item table, this can be a paramaterless function which returns the decimal value and can be treated on forms, reports, etc. as though it were a field.
Adding functions to tables is just slightly more difficult to upgrade than having the the function in a custom code unit, but a custom code unit would require a param and wouldn't be as nice to deal with, so it is a weighed decision.0 -
Thanks for your replies. I decided to use function in a table to get what I needed.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