How to count machine center correctly with some filter?
klum
Member Posts: 102
Hi All,
I need help please. Can anybody correct my code? I filter sales line with field : "work center filter" which i created new field, this field is flowfield :Min("Routing Line"."Work Center No." WHERE (Routing No.=FIELD(No.),Operation No.=CONST(10)))
I filter sales line."Work Center Filter" = 1|5 but when count machine center so they count not only work center no. :1 and no. 5 but count no.3 too. I don't know why i setup "work center filter" 1|5 but when i got the value of "COUNTMACHINE" it filter "1|3|5".
Work Center no. 1 have 5 machine center.
Work Center no. 5 have 4 machine center.
"COUNTMACHINE" should be 9 machine center. but value also count work center no. 3 which have 3 machine center so make value incorrect = 12 machine center.
Please help me
Thank in advance....
Klum
I need help please. Can anybody correct my code? I filter sales line with field : "work center filter" which i created new field, this field is flowfield :Min("Routing Line"."Work Center No." WHERE (Routing No.=FIELD(No.),Operation No.=CONST(10)))
I filter sales line."Work Center Filter" = 1|5 but when count machine center so they count not only work center no. :1 and no. 5 but count no.3 too. I don't know why i setup "work center filter" 1|5 but when i got the value of "COUNTMACHINE" it filter "1|3|5".
Work Center no. 1 have 5 machine center.
Work Center no. 5 have 4 machine center.
"COUNTMACHINE" should be 9 machine center. but value also count work center no. 3 which have 3 machine center so make value incorrect = 12 machine center.
TempMacCenter.RESET;
TempMacCenter.DELETEALL;
SalesLine.RESET;
SalesLine.COPYFILTERS("Sales Line");
IF SalesLine.FIND('-') THEN BEGIN
REPEAT
IF ItemRec.GET(SalesLine."No.") THEN BEGIN
RoutingLine.RESET;
RoutingLine.SETRANGE("Routing No.",ItemRec."Routing No.");
RoutingLine.SETRANGE("Operation No.",'10');
IF RoutingLine.FIND('-') THEN BEGIN
IF WorkCenter.GET(RoutingLine."Work Center No.") THEN BEGIN
MacCenter.RESET;
MacCenter.SETRANGE("Work Center No.",WorkCenter."No.");
MacCenter.SETRANGE(Blocked,FALSE);
IF MacCenter.FIND('-') THEN BEGIN
REPEAT
IF NOT TempMacCenter.GET(MacCenter."No.") THEN BEGIN
TempMacCenter.INIT;
TempMacCenter.TRANSFERFIELDS(MacCenter);
TempMacCenter.INSERT;
CountMachine += 1;
END;
UNTIL MacCenter.NEXT = 0;
END;
END;
END;
END;
UNTIL SalesLine.NEXT = 0;
CountMachine +=MacCenter.COUNT;
END;
Please help me
Klum
0
Comments
-
You wrote:
Work Center no. 1 have 5 machine center.
Work Center no. 5 have 4 machine center.
"COUNTMACHINE" should be 9 machine center.
but your code goes thru work centers from routing lines and routing lines can not include all workcenters and each workcenter can be used more then once.0 -
I just want to count machine center from each work center. So each work center have many machine center.but your code goes thru work centers from routing lines and routing lines can not include all workcenters and each workcenter can be used more then once.
You're right that in routing lines I will got only one workcenter but in this only one workcenter have many machine center that what i want to count. By this code :RoutingLine.RESET; RoutingLine.SETRANGE("Routing No.",ItemRec."Routing No."); RoutingLine.SETRANGE("Operation No.",'10'); IF RoutingLine.FIND('-') THEN BEGIN IF WorkCenter.GET(RoutingLine."Work Center No.") THEN BEGIN MacCenter.RESET; MacCenter.SETRANGE("Work Center No.",WorkCenter."No."); MacCenter.SETRANGE(Blocked,FALSE); IF MacCenter.FIND('-') THEN BEGIN
So why I cannot count machine center correctly? Anybody can help me? or I ask question didn't clear? Please fix my code and suggest me ....thank alot0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K 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
- 327 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