Modification works differently in two companies

bluecat1972
Member Posts: 14
I was unable to find a similar issue, so here goes: Has anyone else experienced issues with modifications not working correctly between two companies in the same database?
I have two companies in my database. Certain tables synchronize between the companies - among them the Item and Vendor tables and related subtables.
We implemented a modification to the Sales Line table to pull the Unit Price from the Item Prices table to help ensure compliance with GSA pricing policies (you cannot sell to your commercial clients for less than the GSA schedule without modifying the schedule, except with a waiver essentially).
The Item Prices table contains various prices over time and must be retained for auditing purposes, so we match the Starting Date with a field on the Vendor Card. The idea is that, if the vendor exists, the filter is set for Starting Date = Vendor Card date when it copies the Unit Price to the Sales Line table as GSA Unit Price, so that if there is no Starting Date = Vendor Card date, GSA Unit Price should be $0.
What I have found is that, given the same data in the Vendor and Item Prices tables for both companies, the code is only working in one of the companies. In the other company, it disregards the filter for the Starting Date and just goes to the last record found for the quantity break.
This is the chunk of code, on the OnValidate trigger of several fields (to be called basically whenever anyone modifies a field that could affect pricing):
GSAPrice.SETFILTER("Item No.","No.");
GSAPrice.SETFILTER("Price Group Code",'GSA');
IF Mfr.GET(Item."Vendor No.") THEN
GSAPrice.SETFILTER("Starting Date",'%1',Mfr."GSA Client Price Imported")
ELSE
GSAPrice.SETFILTER("Starting Date",'..%1',WORKDATE);
IF (Quantity > 0) THEN
GSAPrice.SETFILTER("Quantity Break",'<=%1',Quantity)
ELSE
GSAPrice.SETFILTER("Quantity Break",'1');
IF GSAPrice.FIND('+') THEN BEGIN
"GSA Unit Price" := GSAPrice."Unit Price";
UpdateUnitPrice;
IF Type = Type::"Account (G/L)" THEN
CLEAR("GSA Unit Price");
END;
I am at a loss to explain why it would work in one company but not the other.
I have two companies in my database. Certain tables synchronize between the companies - among them the Item and Vendor tables and related subtables.
We implemented a modification to the Sales Line table to pull the Unit Price from the Item Prices table to help ensure compliance with GSA pricing policies (you cannot sell to your commercial clients for less than the GSA schedule without modifying the schedule, except with a waiver essentially).
The Item Prices table contains various prices over time and must be retained for auditing purposes, so we match the Starting Date with a field on the Vendor Card. The idea is that, if the vendor exists, the filter is set for Starting Date = Vendor Card date when it copies the Unit Price to the Sales Line table as GSA Unit Price, so that if there is no Starting Date = Vendor Card date, GSA Unit Price should be $0.
What I have found is that, given the same data in the Vendor and Item Prices tables for both companies, the code is only working in one of the companies. In the other company, it disregards the filter for the Starting Date and just goes to the last record found for the quantity break.
This is the chunk of code, on the OnValidate trigger of several fields (to be called basically whenever anyone modifies a field that could affect pricing):
GSAPrice.SETFILTER("Item No.","No.");
GSAPrice.SETFILTER("Price Group Code",'GSA');
IF Mfr.GET(Item."Vendor No.") THEN
GSAPrice.SETFILTER("Starting Date",'%1',Mfr."GSA Client Price Imported")
ELSE
GSAPrice.SETFILTER("Starting Date",'..%1',WORKDATE);
IF (Quantity > 0) THEN
GSAPrice.SETFILTER("Quantity Break",'<=%1',Quantity)
ELSE
GSAPrice.SETFILTER("Quantity Break",'1');
IF GSAPrice.FIND('+') THEN BEGIN
"GSA Unit Price" := GSAPrice."Unit Price";
UpdateUnitPrice;
IF Type = Type::"Account (G/L)" THEN
CLEAR("GSA Unit Price");
END;
I am at a loss to explain why it would work in one company but not the other.
0
Comments
-
It's difficult to say without data. Code is code, it doesn't decide to sometimes do this and sometimes do that. I know NAV has its quirks, but the code does what you (and to some extent data) tell it to.
That said I will still continue to blame the code every time it doesn't work0 -
Use debugger tool to detect problem.0
-
You say some tables are synchronized across companies, so I am wondering if you use CHANGECOMPANY. If that's the case, then you will need to make sure that there is no VALIDATE into other companies, as this doesn't work, and would explain why you get unpredictable results.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