<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE qml SYSTEM "/wt/query/qml/qml.dtd">
<qml bypassAccessControl="true">
	<parameter name="Product Iteration (1 = Latest)" type="java.lang.Object">
		<parameterDefault isMacro="false">
			1
		</parameterDefault>
	</parameter>
	<parameter name="Version" type="java.lang.Object"/>
	<parameter name="Product Number" type="java.lang.Object"/>
	<statement>
		<query>
			<select distinct="true" group="true">
				<column alias="RoleA Part" heading="Number" isExternal="false" propertyName="number" selectOnly="false" type="java.lang.String">
					master&gt;number
				</column>
				<column alias="RoleA Part" heading="Name" isExternal="false" propertyName="name" selectOnly="false" type="java.lang.String">
					master&gt;name
				</column>
				<column alias="RoleA Part" heading="versionInfo.identifier.versionId" isExternal="false" selectOnly="false" type="java.lang.String">
					versionInfo.identifier.versionId
				</column>
				<column alias="RoleA Part" heading="iterationInfo.identifier.iterationId" isExternal="false" selectOnly="false" type="java.lang.String">
					iterationInfo.identifier.iterationId
				</column>
				<column alias="Part Usage" heading="Line Number.Value" isExternal="false" propertyName="lineNumber.value" selectOnly="false" type="long">
					lineNumber.value
				</column>
				<column alias="Part (wt.part.WTPartMaster)" heading="Part (wt.part.WTPartMaster) Number" isExternal="false" propertyName="number" selectOnly="false" type="java.lang.String">
					number
				</column>
				<column alias="Part (wt.part.WTPartMaster)" heading="Part (wt.part.WTPartMaster) Name" isExternal="false" propertyName="name" selectOnly="false" type="java.lang.String">
					name
				</column>
				<column alias="Part Usage" heading="Quantity.Amount" isExternal="false" propertyName="quantity.amount" selectOnly="false" type="double">
					quantity.amount
				</column>
				<column alias="Part Usage" heading="Quantity.Unit" isExternal="false" propertyName="quantity.unit" selectOnly="false" type="wt.part.QuantityUnit">
					quantity.unit
				</column>
				<column alias="RoleA Part" heading="State" isExternal="false" propertyName="lifeCycleState" selectOnly="false" type="wt.lifecycle.State">
					state.state
				</column>
				<column alias="Context" heading="Context Name (name)" isExternal="false" propertyName="name" selectOnly="false" type="java.lang.String">
					containerInfo.name
				</column>
			</select>
			<from>
				<table alias="RoleA Part" isExternal="false">
					wt.part.WTPart
				</table>
				<table alias="Part Usage" isExternal="false">
					wt.part.WTPartUsageLink
				</table>
				<table alias="Part (wt.part.WTPartMaster)" isExternal="false">
					wt.part.WTPartMaster
				</table>
				<table alias="Context" isExternal="false">
					wt.inf.container.WTContainer
				</table>
			</from>
			<where>
				<compositeCondition type="and">
					<condition>
						<operand>
							<parameterTarget name="Product Number"/>
						</operand>
						<operator type="equal"/>
						<operand>
							<column alias="RoleA Part" heading="Number" isExternal="false" propertyName="number" selectOnly="false" type="java.lang.String">
								master&gt;number
							</column>
						</operand>
					</condition>
					<condition>
						<operand>
							<column alias="RoleA Part" heading="Latest Iteration" isExternal="false" propertyName="latestIteration" selectOnly="false" type="boolean">
								iterationInfo.latest
							</column>
						</operand>
						<operator type="equal"/>
						<operand>
							<parameterTarget name="Product Iteration (1 = Latest)"/>
						</operand>
					</condition>
					<condition>
						<operand>
							<column alias="RoleA Part" heading="versionInfo.identifier.versionId" isExternal="false" selectOnly="false" type="java.lang.String">
								versionInfo.identifier.versionId
							</column>
						</operand>
						<operator type="equal"/>
						<operand>
							<function heading="Upper" name="UPPER" type="java.lang.String">
								<parameterTarget name="Version"/>
							</function>
						</operand>
					</condition>
				</compositeCondition>
			</where>
			<orderBy>
				<orderByItem type="asc">
					<columnTarget heading="Number"/>
				</orderByItem>
				<orderByItem type="asc">
					<columnTarget heading="versionInfo.identifier.versionId"/>
				</orderByItem>
				<orderByItem type="asc">
					<columnTarget heading="iterationInfo.identifier.iterationId"/>
				</orderByItem>
				<orderByItem type="asc">
					<columnTarget heading="Line Number.Value"/>
				</orderByItem>
			</orderBy>
			<referenceJoin>
				<join name="roleAObjectRef">
					<aliasTarget alias="Part Usage"/>
					<aliasTarget alias="RoleA Part"/>
				</join>
				<join name="roleBObjectRef">
					<aliasTarget alias="Part Usage"/>
					<aliasTarget alias="Part (wt.part.WTPartMaster)"/>
				</join>
				<join name="containerReference">
					<aliasTarget alias="Part (wt.part.WTPartMaster)"/>
					<aliasTarget alias="Context"/>
				</join>
			</referenceJoin>
		</query>
	</statement>
</qml>
