I have 3 tables i am building reports from.
Work Orders
PM Orders
Parts
I have a column on the Reports table that is an Enum with 3 options Work Orders, PM Orders and Parts. The below select statement im working on to filter the selection down. I cant figure out how to add a condition in the select statement to show only work orders if the Work Orders type is selected then filter by all the work order filters and so on.
______________________________________________________________________________________________________
Select(worders[Worderid],and(
if(isnotblank([Report_WOID#]),
in([WOrderID], [_thisrow].[Report_WOID#]),
true),
if(isnotblank([Report_WO_Type]),
[WO_Type] = [_thisrow].[Report_WO_Type],
true),
if(isnotblank([Report_WO_Priority]),
in([Priority], [_thisrow].[Report_WO_Priority]),
true),
if(isnotblank([Report_WO_Approve]),
[Approve] = [_thisrow].[Report_WO_Approve],
true),
if(isnotblank([Report_WO_SchDate_Start]),
[Sch_Date] >= [_thisrow].[Report_WO_SchDate_Start],
true),
if(isnotblank([Report_WO_SchDate_End]),
[Sch_Date] <= [_thisrow].[Report_WO_SchDate_End],
true),
if(isnotblank([Report_WO_CompletedDate_Start]),
[Completed_Date] >= [_thisrow].[Report_WO_CompletedDate_Start],
true),
if(isnotblank([Report_WO_CompletedDate_End]),
[Completed_Date] <= [_thisrow].[Report_WO_CompletedDate_End],
true),
if(isnotblank([Report_WO_CompletedBy]),
in([Completed_By], [_thisrow].[Report_WO_CompletedBy]),
true),
if(isnotblank([Report_WO_Status]),
[WO_Status] = [_thisrow].[Report_WO_Status],
true),
if(isnotblank([Report_Dept]),
[Department] = [_thisrow].[Report_Dept],
true),
if(isnotblank([Report_MC]),
[Machine_Center] = [_thisrow].[Report_MC],
true),
if(isnotblank([Report_Eq]),
[Equipment] = [_thisrow].[Report_Eq],
true),
if(isnotblank([Report_Date_Min]),
[Order_Creation_Date] >= [_thisrow].[Report_Date_Min],
true),
if(isnotblank([Report_Date_Max]),
[Order_Creation_Date] <= [_thisrow].[Report_Date_Max],
true)))+
Select(PM_Service[PMID_Link],and(
if(isnotblank([Report_Dept]),
[PMid_Link].[Department] = [_thisrow].[Report_Dept],
true),
if(isnotblank([Report_MC]),
[PMid_Link].[Machine_Center] = [_thisrow].[Report_MC],
true),
if(isnotblank([Report_Eq]),
[PMid_Link].[Equipment] = [_thisrow].[Report_Eq],
true),
if(isnotblank([Report_Date_Min]),
[PMService_Creation_Date] >= [_thisrow].[Report_Date_Min],
true),
if(isnotblank([Report_Date_Max]),
[PMService_Creation_Date] <= [_thisrow].[Report_Date_Max],
true),
if(isnotblank([Report_PMID#]),
[PMID_Link] = [_thisrow].[Report_PMID#],
true),
if(isnotblank([Report_PMS_Status]),
[Auto_PMStatus] = [_thisrow].[Report_PMS_Status],
true)
))
@bmayers wrote:
a condition in the select statement to show only work orders if the Work Orders type is selected
While I don't follow your question, your very dense expression, or how nesting is involved, the literal answer to this question is seemingly straightforward. In case that's really all you're asking:
AND([Enum Column] = "Work Orders", ..., ..., ...)
yes sorry it was a really simple solution. I was over looking a small piece
all i needed to add was [report_type]="Work Orders" and [report_type]="Pm Orders" to make the select statement work depending on which report type was selected.
Select(worders[Worderid],and(
if(isnotblank([Report_WOID#]),
in([WOrderID], [_thisrow].[Report_WOID#]),
true),
if(isnotblank([Report_WO_Type]),
[WO_Type] = [_thisrow].[Report_WO_Type],
true),
Select(PM_Service[PMID_Link],and(
if(isnotblank([Report_Dept]),
[PMid_Link].[Department] = [_thisrow].[Report_Dept],
true),
if(isnotblank([Report_MC]),
[PMid_Link].[Machine_Center] = [_thisrow].[Report_MC],
true)
))
User | Count |
---|---|
42 | |
29 | |
28 | |
14 | |
14 |