G
Guest
Good morning
I've got some pretty hefty spreadsheets that have the calculations replicated for each spreadsheet. So, rather than inserting the calculations all the time, I'd like to just import each table when I need to, and let the query do its thing
An explanation: my company is a large distribitor of product with specific attributes according to its destination. However, we know that I can fit 30 units per case and that if an order calls for a full number of cases, I can select the case. If it calls for remainders, I can select them either 3, 2, or 1 to my arm (to assist with batching). When I will hit or pass 12 units accummulated to my arm, I will take them either 6, 2, or 1 and put them in the case on the conveyor.
My table is
LOA
STO
DEPT/STAT
SLO
PIECE
For example
0101 01 CC 00111
0101 01 CC 00112 2
0101 01 CC 00113
The query only needs to be geared toward pieces. Here's the SQL so far
SELECT Cigs.Pieces, Int([pieces]/30)+IIf([pieces]/30-(Int([pieces]/30))>0.5,1,0) AS Countcases, Abs([pieces]-[countcases]*30) AS RemfromCases, Int([remfromcases]/3) AS 3toarm, Int(([remfromcases]-(3*Int([remfromcases]/3)))/2) AS 2toarm, [remfromcases]-3*Int([remfromcases]/3)-2*Int(([remfromcases]-(3*Int([remfromcases]/3)))/2) AS 1toar
FROM Cigs
This gets the product to my arm. However, I need to use the logic in the explanation above to determine when and how many units will be cased.
I know that this can be done in Reports. However, I need it done in Queries
This is to determine how often (probability) a particular arm move will occur
Can someone please help
Derek
I've got some pretty hefty spreadsheets that have the calculations replicated for each spreadsheet. So, rather than inserting the calculations all the time, I'd like to just import each table when I need to, and let the query do its thing
An explanation: my company is a large distribitor of product with specific attributes according to its destination. However, we know that I can fit 30 units per case and that if an order calls for a full number of cases, I can select the case. If it calls for remainders, I can select them either 3, 2, or 1 to my arm (to assist with batching). When I will hit or pass 12 units accummulated to my arm, I will take them either 6, 2, or 1 and put them in the case on the conveyor.
My table is
LOA
STO
DEPT/STAT
SLO
PIECE
For example
0101 01 CC 00111
0101 01 CC 00112 2
0101 01 CC 00113
The query only needs to be geared toward pieces. Here's the SQL so far
SELECT Cigs.Pieces, Int([pieces]/30)+IIf([pieces]/30-(Int([pieces]/30))>0.5,1,0) AS Countcases, Abs([pieces]-[countcases]*30) AS RemfromCases, Int([remfromcases]/3) AS 3toarm, Int(([remfromcases]-(3*Int([remfromcases]/3)))/2) AS 2toarm, [remfromcases]-3*Int([remfromcases]/3)-2*Int(([remfromcases]-(3*Int([remfromcases]/3)))/2) AS 1toar
FROM Cigs
This gets the product to my arm. However, I need to use the logic in the explanation above to determine when and how many units will be cased.
I know that this can be done in Reports. However, I need it done in Queries
This is to determine how often (probability) a particular arm move will occur
Can someone please help
Derek