Question

# Dynamic BOM calculations

• 30 views

I’m trying to create dynamic bill of material calculations based on run quantity. For example, my machine time is dependent on how many I need to produce. Each unit takes 25 seconds. I would like to create my BOM so that all you have to input is quantity, and all the other fields are populated based on that. Any advice on how to do this?

To create a dynamic Bill of Material (BOM) calculation in Acumatica based on the run quantity (e.g., adjusting machine time automatically based on the number of units), you can leverage Acumatica's BOM attributes and formulas to automate these calculations.

### Approach:

1. Use Formulas in the BOM: Acumatica allows you to set up BOM attributes that use formulas to calculate values dynamically. You can set the machine time or other required variables based on the quantity entered.

2. Leverage Attributes and Matrices in the Manufacturing Module: The Acumatica Manufacturing Edition supports attributes and matrices for flexible BOM creation. By utilizing these features, you can create calculations that automatically adjust based on input values like quantity.

3. Implement Customization (if needed): If Acumatica's built-in functionality doesn’t fully meet your needs, you can extend it using custom DAC fields and business logic.

### Step-by-Step Guide:

#### 1. Configure Your BOM and Routing:

• Set up your BOM as usual with the list of raw materials, machine time, and labor operations.
• In the Routing step, where you define the machine operations, define the machine time as a variable value rather than a static number.

#### 2. Create an Attribute for Machine Time Calculation:

• Navigate to Manufacturing → Bill of Materials → Attributes.
• Create a new attribute for Machine Time that will be based on a formula.

Example formula for machine time:

` `

formula

`MachineTime = (Quantity * TimePerUnit) `

Where:

• `Quantity` is the number of units you want to produce.
• `TimePerUnit` is the time it takes to produce one unit (in your case, 25 seconds per unit).

#### 3. Use a Formula to Automatically Populate Fields:

Acumatica allows you to use formulas in BOM attributes to automatically calculate values based on user inputs (such as quantity).

To calculate machine time based on quantity:

• Set up a formula like:
` `

csharp

`MachineTime = @Quantity * 25 / 60 // converts seconds into minutes `

This would calculate the machine time in minutes based on the quantity entered by the user.

#### 4. Create a Matrix-Based BOM (Optional):

If you have a more complex product structure where multiple variables affect the BOM (e.g., size, weight, or other characteristics), you can create a matrix BOM.

• A matrix BOM allows for dynamic selection of components or operations based on multiple criteria, including the run quantity.

#### 5. Testing the Setup:

After setting up the attributes and formulas:

• Test the BOM by entering a production quantity.
• Ensure that the machine time and any other dynamic fields automatically update based on the quantity you input.

#### 6. Further Customization (Optional):

If Acumatica’s formula fields are not sufficient, you can extend the system by creating custom fields in the BOM or Routing tables (DACs) and writing a Business Logic Extension (BLC) that performs the necessary calculations.

For example, you could add a custom DAC field for MachineTime and create a business logic class that automatically updates this field based on the entered production quantity.

### Example Customization (Optional):

If you want to write a small customization that dynamically calculates machine time, here’s a simplified example using C# in Acumatica:

` `

csharp

`public class BOMExtension : PXGraphExtension<BOMMaint> { protected void _(Events.FieldUpdated<BOMSetup.qty> e) { var row = (BOMSetup)e.Row; if (row != null && row.Qty != null) { // Calculate machine time based on quantity row.MachineTime = row.Qty * 25 / 60; // Time in minutes } } } `

This customization ensures that whenever the quantity is updated, the machine time is dynamically calculated based on the entered quantity.

### Conclusion:

To achieve dynamic BOM calculations based on production quantity, you can either use Acumatica’s built-in formulas and attributes or create a customization that automatically adjusts the machine time and other fields based on input. This approach minimizes manual data entry and improves the accuracy of your manufacturing process calculations.

If your requirements extend beyond the standard capabilities, adding custom business logic will give you the flexibility needed to automate BOM calculations fully.