PSLine2000Documentation/Queries/Q1MainMenu.md

3.3 KiB

Q1MainMenu

Analysis generated on: 4/2/2025 10:07:51 AM

SQL Statement

SELECT DISTINCTROW Process.PartName, Process.PartNumber, Process.RevisionLevel, Process.IssueNumber, Process.IssueDate, Process.PreviousIssue, Process.PreviousDate, Process.Programmer, Process.PrintSize, Process.History, Process.MetalType, Process.CutType, Process.PrimeMachine, Process.GrainDir, Process.Deburr, Process.FirstDim, Process.SecDim, Process.PartHeight, Process.BotTrimCut, Process.TopTrimCut, Process.PartWidth, Process.BlankSize, Process.PartSize, Process.GrossWt, Process.ActualWt, Process.Utilization, Process.SheetSize, AddnlProc.ID, AddnlProc.Generated, AddnlProc.OPCode, AddnlProc.Description, AddnlProc.WC1, AddnlProc.WC2, AddnlProc.WC3, AddnlProc.WC4, AddnlProc.Machine, AddnlProc.CycleTime, AddnlProc.RunStd, Process.PartsPerBlank, Process.PartsPerSheet, Process.BlocksPerSheet, Process.BlanksPerBlock, Metals.MetalName, Metals.Gauge, Metals.Density, Process.MaterialCost, Process.LaborCost, Process.PartCost, Process.Reason, Process.CalculationStatus, Metals.Units
FROM (Process INNER JOIN Metals ON Process.MetalType = Metals.PartNo) INNER JOIN AddnlProc ON Process.PartNumber = AddnlProc.PartNumber
WHERE ((Process.PartNumber=[Forms]![Main Menu]![Partnumber]) AND ((Left([OPCode],1))<>"*" And (Left([OPCode],1))<>"!" And (Left([OPCode],1))<>"$"));

Dependencies

Parameters

  • [Forms]![Main Menu]![Partnumber] (Empty)

What it does

SQL Query Description

Purpose

This SQL query retrieves distinct rows from two tables, Process and AddnlProc, joined with the Metals table. The query filters results based on specific conditions related to a part number.

Tables and Joining

The query joins three tables:

  1. Process: contains process-related data for parts.
  2. Metals: contains metal-related data.
  3. AddnlProc: contains additional process-related information.

The join condition is Process.MetalType = Metals.PartNo, which links a part's metal type to its corresponding metal record in the Metals table.

Filtering

The query applies filters to narrow down the results:

  1. Part Number: The query only considers rows where the PartNumber column matches a specified value stored in a cell of the Excel spreadsheet (Forms![Main Menu]![Partnumber]). This is done using an inner join.
  2. OPCode Prefix: The query filters out rows where the first character of the OPCode column is either "*", "!"
  3. OPCode Character: The query also filters out rows where the first character of the OPCode column is either $

Selected Columns

The query retrieves a wide range of columns from both tables, including:

  • Process-related data (Part Name, Revision Level, Issue Number, etc.)
  • Metal-related data (MetalName, Gauge, Density)
  • Additional process information (ID, Generated, OPCode, Description, etc.)

DISTINCTROW Clause

The DISTINCTROW clause ensures that each row returned by the query contains unique values for the selected columns.

Query Notes

  • The use of Excel cells (Forms![Main Menu]![Partnumber]) to filter data suggests that this query is part of a larger application or report generation process.
  • The specific filtering conditions and column selection may indicate that this query is designed to analyze or generate reports for specific parts or processes.