How to Implement Batch Data Entry and Quoting via a Button After Uploading Product Details?
**Quotes Table Fields:**
- **'Customer'**: Linked to the Customer table
- **'Quote Number'**: Auto-generated number
- **'Quote Date'**:
- **'Quote Validity Period'**:
- **'Quote Batch Number' (Text)**: Batch number
- **Subtable**: Positions (one-to-many relationship already exists)
**Positions Subtable Fields:**
- **'Material Code' (Text)**:
- **'Specification Model' (Text)**:
- **'Description' (Text)**:
- **'Quantity' (Number)**:
- **'Tax-Included Unit Price' (Number)**:
- **'Quote' (Reference to Quotes)**: Linked to the Quotes table.
- **'Total Price' (Formula, Optional)**: Formula = `'Quantity' * 'Tax-Included Unit Price'`.
**Import Table Fields:**
- **'Material Code' (Text)**: Material code.
- **'Specification Model' (Text)**: Specification/model.
- **'Product Name' (Text)**: Product name.
- **'Latest Version' (Text)**: Latest version.
- **'Quantity' (Number)**: Quantity.
- **'Tax-Included Unit Price' (Number)**: Tax-included unit price.
- **'Quote Batch Number' (Text)**: Batch number.
**Add a new button to the Quotes table:**
- **Button Name**: "Bulk Upload Quote Details List"
**Functionality upon clicking the button:**
1. Query the value of the **'Quote Batch Number' (Text)** field in the Quotes table. If records matching this value are found in the **'Quote Batch Number'** field of the Import table,
2. Copy all matching records from the Import table to the **Positions** subtable of the current Quotes table.
**Field Mapping:**
- **Positions'Material Code'** **Import table's 'Material Code'**
- **Positions'Specification Model'** **Import table's 'Specification Model'**
- **Positions'Description'** **Import table's 'Product Name'**
- **Positions'Quantity'** **Import table's 'Quantity'**
- **Positions'Tax-Included Unit Price'** **Import table's 'Tax-Included Unit Price'**
This ensures seamless batch import of quote details while maintaining data consistency.
4 replies
-
You can try something like:
let t := this; let importRecs := select ImportTable where 'Quote Batch Number' = t.'Batch Number'; for import in importRecs do create Positions.( Quote := t; 'Material Code' := import.'Material Code' ) end
You said the button would be in the Quotes table so it is written from that perspective.
Line 1: puts the current Quote record in a variable.
Line 2: finds all records in Import Table (make sure to put the actual name of the table) where the Quote Batch Number matches the current Quote record Batch Number and puts it in a variable
Lines 3 - 8: starts a for loop that goes through each record from line 2 and,
1) creates a new record, line 4, in the Positions table
2) then links, line 5, the new Positions record to the current Quote record using the variable from line 1.
3) copies the data, line 6, from the 'Material Code' field of the ImportTable record to the 'Material Code' field of the new Positions record.
You can add more lines some testing to make sure the linking works.
There is no checking of anything so it will keep making new records on every press of the button.
Content aside
- 11 days agoLast active
- 4Replies
- 39Views
-
3
Following