ValidateBomData Activity
Purpose: This activity validates the integrity of BOM (Bill of Materials) data. It checks for required fields, validates quantity values, and ensures part numbers are not empty. The BOM data should be provided as a JSON string, typically obtained from the ExtractBomData activity.
Input Properties
The BOM data as a JSON string. This should contain structured BOM data with dictionaries for ItemNumber, PartNumber, Description, Quantity, Material, and CustomProperties.
Type: string
Default: "" (empty string)
Example: {"ItemNumber": {"1": "1"}, "PartNumber": {"1": "PN-001"}, "Description": {"1": "Part Description"}, "Quantity": {"1": "5"}, "Material": {...}, "CustomProperties": {...}}
Note: The JSON should match the structure returned by ExtractBomData activity.
Output Properties
True if the BOM data is valid; otherwise false. The data is considered valid if all required fields are present, quantities are valid non-negative integers, and part numbers are not empty.
Type: bool
Note: This will be false if the JSON is null/empty, if deserialization fails, if required fields are missing, if quantities are invalid, or if part numbers are empty.
Validation error message if any. Contains a description of why validation failed, or a success message if validation passed.
Type: string
Note: If validation passes, this will contain "BOM data is valid." If validation fails, this will contain a specific error message describing the issue. If an exception occurs, this will contain "Validation error: {exception message}".
Example (Success): "BOM data is valid."
Example (Error): "BOM data JSON is null or empty." or "BOM data validation failed."
Usage Example
Scenario: Validate BOM data extracted from an assembly
Configuration:
- BomDataJson: "{\"ItemNumber\": {\"1\": \"1\"}, \"PartNumber\": {\"1\": \"PN-001\"}, \"Description\": {\"1\": \"Part Description\"}, \"Quantity\": {\"1\": \"5\"}}"
Result:
- IsValid: true
- ErrorMessage: "BOM data is valid."
Error Handling
Important: The activity handles errors gracefully:
- If BomDataJson is null or empty, IsValid will be
falseand ErrorMessage will be"BOM data JSON is null or empty." - If JSON deserialization fails, IsValid will be
falseand ErrorMessage will be"Failed to deserialize BOM data." - If required fields are missing (ItemNumber, PartNumber, Description, Quantity), IsValid will be
falseand ErrorMessage will be"BOM data validation failed." - If quantities are invalid (negative or non-numeric), IsValid will be
falseand ErrorMessage will be"BOM data validation failed." - If part numbers are empty, IsValid will be
falseand ErrorMessage will be"BOM data validation failed." - If any exception occurs during validation, IsValid will be
falseand ErrorMessage will be"Validation error: {exception message}"
Always check the IsValid output to ensure the BOM data is valid before using it in subsequent activities. Review the ErrorMessage for details about validation failures.
Validation Rules
The activity validates the following:
- Required Fields: The BOM data must contain the following top-level dictionaries:
ItemNumber- Item numbers for each BOM entryPartNumber- Part numbers for each BOM entryDescription- Descriptions for each BOM entryQuantity- Quantities for each BOM entry
- Quantity Validation: All quantity values must be valid non-negative integers
- Part Number Validation: All part numbers must be non-empty strings
Important Notes
- The BOM data JSON should match the structure returned by the ExtractBomData activity
- Validation checks for required fields, valid quantities, and non-empty part numbers
- If validation fails, check the ErrorMessage output for specific details about what failed
- This activity does not modify the BOM data - it only validates it
- Use this activity after extracting BOM data to ensure data integrity before processing or exporting
- The validation is performed using the service layer, which provides comprehensive validation logic
Related Activities
- ExtractBomData - Extract BOM data from a document as JSON (typically used before validation)
- ExportBomToExcel - Export BOM data to Excel file
- InsertBomTable - Insert a BOM table into a document