PSLine2000Documentation/Queries/DedicatedCellQ.md

56 lines
2.4 KiB
Markdown

# DedicatedCellQ
Analysis generated on: 4/2/2025 9:59:08 AM
---
## SQL Statement
```sql
SELECT ProductMaster.PRDNO, DedicatedCells.Active, DedicatedCells.AlphaCode, DedicatedCells.Machine
FROM ProductMaster INNER JOIN DedicatedCells ON ProductMaster.PALPH = DedicatedCells.AlphaCode
WHERE (((ProductMaster.PRDNO)=Left([Forms]![Process Sheet]![PartNumber],7)) AND ((DedicatedCells.Active)=True));
```
## Dependencies
- [[Tables/ProductMaster]]
- [[Tables/DedicatedCells]]
## Parameters
- [Forms]![Process Sheet]![PartNumber] (Empty)
## What it does
**SQL Query Description**
==========================
This SQL query retrieves data from two tables, `ProductMaster` and `DedicatedCells`, based on specific conditions. The query is designed to find the dedicated cells for a given part number.
### Query Components
* **Inner Join**: The query performs an inner join between the `ProductMaster` table and the `DedicatedCells` table on the `PALPH` column in `ProductMaster` and the `AlphaCode` column in `DedicatedCells`.
* **Filter Conditions**:
* `ProductMaster.PRDNO = Left([Forms]![Process Sheet]![PartNumber], 7)`: This condition filters the results to include only rows where the part number (`PRDNO`) matches the first seven characters of the value in the `PartNumber` field on a form called "Process Sheet".
* `DedicatedCells.Active = True`: This condition further filters the results to include only active cells.
* **Selected Columns**:
* The query selects columns from both tables: `PRDNO`, `Active`, `AlphaCode`, and `Machine`.
### Query Functionality
This SQL query is designed to:
1. Find dedicated cells for a specific part number based on the first seven characters of the part number.
2. Filter the results to only include active cells.
### Example Use Case
This query can be used in an inventory management system to display information about dedicated cells for a particular product.
**Query Breakdown**
-------------------
* **Table Names and Columns**: `ProductMaster`, `PRDNO`; `DedicatedCells`, `Active`, `AlphaCode`, `Machine`.
* **Join Condition**: `PALPH = AlphaCode`.
* **Filter Conditions**:
* Part number matching.
* Active cells only.
* **Selected Columns**: `PRDNO`, `Active`, `AlphaCode`, `Machine`.
**Formulas Used**
-----------------
* `Left([Forms]![Process Sheet]![PartNumber], 7)` to extract the first seven characters of the part number.