I am glad that somebody came out with this counting question days before, however, I would like to take a step further to ask a similar question that many manufacturing/production line would encounter.
Using the same color example, having different color product like red, blue, green, yellow,white. By using the count_color script we can directly calculating count for each color.
Then, if I am going to cumulative 5 count of the same color product into a box as a shipment unit. When a certain color product reach its maximum boxing capacity, the upcoming product with the same color will automatically reset the count back to 1. In order to distinguish production sequence of each box that contains the same color of production, the Box column should hold a format like RED-1, RED-2,....
One more constraint is the count_color need to distinguish/sort the product is created in which Shift (Day, or Night). Please refer to the table below.
I am hoping a useful jsl script can be designed to help to meet this kind of request for generating count_color column as well as Box column.
Thanks
| color | count_color | Shift | Box |
|---|
| ..... | ..... | | |
| RED | 4 | NIGHT | RED-4 |
| RED | 5 | NIGHT | RED-4 |
| RED | 1 | DAY | RED-1 |
| RED | 2 | DAY | RED-1 |
| BLUE | 1 | NIGHT | BLUE-3 |
| YELLOW | 1 | DAY | YELLOW-2 |
| BLUE | 2 | NIGHT | BLUE-3 |
| GREEN | 1 | NIGHT | GREEN-2 |
| RED | 3 | DAY | RED-1 |
| BLUE | 1 | DAY | BLUE-1 |
| GREEN | 1 | NIGHT | GREEN-2 |
| WHITE | 1 | NIGHT | WHITE-1 |
| WHITE | 1 | DAY | WHITE-1 |
| RED | 4 | DAY | RED-1 |
| RED | 5 | DAY | RED-1 |
| RED | 1 | DAY | RED-2 |
| BLUE | 3 | NIGHT | BLUE-3 |
| YELLOW | 2 | DAY | YELLOW-2 |
| RED | 1 | NIGHT | RED-1 |