This is the current code I am using:
With(
{
Objects: If(
// EDW Project is TBD
ProjectPicker_1.Selected.Result = "TBD",
ForAll(
Sort(
Search(
OBJECT_DETAIL_UNATTACHED,
box_Source_Object_Search.Text,
"Object_Combined_Name"
),
Object_Combined_Name
),
{
Object_Id: Object_Id,
Object_Name: Object_Name,
Object_Type: Object_Type,
Server: Server,
Database: Database,
Schema: Schema,
Object_Combined_Name: Object_Combined_Name,
Obsolete_Code: Obsolete_Code,
Reported_Code: Reported_Code,
Notes: Notes,
Created_Person_Id: Created_Person_Id,
Created_Ts: Created_Ts,
Last_Updated_Person_Id: Last_Updated_Person_Id,
Last_Updated_Ts: Last_Updated_Ts
}
),
// else EDW Project is NOT TBD
If(
Roots,
ForAll(
Sort(
Search(
/*-------------------- begin code block to filter objects by edw project -----------------*/
Filter(
OBJECT_DETAIL_ROOTS,
Object_Id in
// directly linked to a report in EDW project
Filter(
REPORT_OBJECT_LINK,
Report_Id in Filter(
REPORT_DETAIL,
// delegation warning should be okay since there shouldn't be > 2,000 reports for a single project
EDW_Project = ProjectPicker_1.Selected.Result
).Report_Id
).Object_Id Or// in any part of an object lineage for an object that is directly linked to a report in EDW project
Object_Id in// Level 1
Filter(
OBJECT_LEVEL_LINEAGE,
Master_Object_Id in
// make sure Master Object directly linked to report in EDW project
Filter(
REPORT_OBJECT_LINK,
Report_Id in Filter(
REPORT_DETAIL,
// delegation warning should be okay since there shouldn't be > 2,000 reports for a single project
EDW_Project = ProjectPicker_1.Selected.Result
).Report_Id
).Object_Id
).Level1_Object_Id Or Object_Id in// Level 2
Filter(
OBJECT_LEVEL_LINEAGE,
Master_Object_Id in
// directly linked to a report
Filter(
REPORT_OBJECT_LINK,
Report_Id in Filter(
REPORT_DETAIL,
// delegation warning should be okay since there shouldn't be > 2,000 reports for a single project
EDW_Project = ProjectPicker_1.Selected.Result
).Report_Id
).Object_Id
).Level2_Object_Id Or Object_Id in// Level 3
// object in a lineage that is linked to a report
Filter(
OBJECT_LEVEL_LINEAGE,
Master_Object_Id in
// directly linked to a report
Filter(
REPORT_OBJECT_LINK,
Report_Id in Filter(
REPORT_DETAIL,
// delegation warning should be okay since there shouldn't be > 2,000 reports for a single project
EDW_Project = ProjectPicker_1.Selected.Result
).Report_Id
).Object_Id
).Level3_Object_Id Or Object_Id in// Level 4
// object in a lineage that is linked to a report
Filter(
OBJECT_LEVEL_LINEAGE,
Master_Object_Id in
// directly linked to a report
Filter(
REPORT_OBJECT_LINK,
Report_Id in Filter(
REPORT_DETAIL,
// delegation warning should be okay since there shouldn't be > 2,000 reports for a single project
EDW_Project = ProjectPicker_1.Selected.Result
).Report_Id
).Object_Id
).Level4_Object_Id Or Object_Id in// Level 5
// object in a lineage that is linked to a report
Filter(
OBJECT_LEVEL_LINEAGE,
Master_Object_Id in
// directly linked to a report
Filter(
REPORT_OBJECT_LINK,
Report_Id in Filter(
REPORT_DETAIL,
// delegation warning should be okay since there shouldn't be > 2,000 reports for a single project
EDW_Project = ProjectPicker_1.Selected.Result
).Report_Id
).Object_Id
).Level5_Object_Id Or Object_Id in// Level 6
// object in a lineage that is linked to a report
Filter(
OBJECT_LEVEL_LINEAGE,
Master_Object_Id in
// directly linked to a report
Filter(
REPORT_OBJECT_LINK,
Report_Id in Filter(
REPORT_DETAIL,
// delegation warning should be okay since there shouldn't be > 2,000 reports for a single project
EDW_Project = ProjectPicker_1.Selected.Result
).Report_Id
).Object_Id
).Level6_Object_Id Or Object_Id in// Root
// object in a lineage that is linked to a report
Filter(
OBJECT_LEVEL_LINEAGE,
Master_Object_Id in
// directly linked to a report
Filter(
REPORT_OBJECT_LINK,
Report_Id in Filter(
REPORT_DETAIL,
// delegation warning should be okay since there shouldn't be > 2,000 reports for a single project
EDW_Project = ProjectPicker_1.Selected.Result
).Report_Id
).Object_Id
).Root_Source_Object_Id Or//Object is EDW object mapped to a root object in a lineage for an object directly linked to report in EDW project
Object_Id in// EDW Mapping
Filter(
EDW_TO_ROOT_OBJECT_MAP,
Root_Source_Object_Id in
// lineage where master object directly linked to report
Filter(
OBJECT_LEVEL_LINEAGE,
Master_Object_Id in
// directly linked to a report
Filter(
REPORT_OBJECT_LINK,
Report_Id in Filter(
REPORT_DETAIL,
// delegation warning should be okay since there shouldn't be > 2,000 reports for a single project
EDW_Project = ProjectPicker_1.Selected.Result
).Report_Id
).Object_Id
).Root_Source_Object_Id
).EDW_Object_Id
)
/*-------------------- end code block to filter objects by edw project -----------------*/,
box_Source_Object_Search.Text,
"Object_Combined_Name"
),
Object_Combined_Name
),
{
Object_Id: Object_Id,
Object_Name: Object_Name,
Object_Type: Object_Type,
Server: Server,
Database: Database,
Schema: Schema,
Object_Combined_Name: Object_Combined_Name,
Obsolete_Code: Obsolete_Code,
Reported_Code: Reported_Code,
Notes: Notes,
Created_Person_Id: Created_Person_Id,
Created_Ts: Created_Ts,
Last_Updated_Person_Id: Last_Updated_Person_Id,
Last_Updated_Ts: Last_Updated_Ts
}
),
If(
RootsNoEDW,
ForAll(
Sort(
Search(
/*-------------------- begin code block to filter objects by edw project -----------------*/
Filter(
OBJECT_DETAIL_ROOTS_MISSING_EDW_EQUIVALENT,
Object_Id in
// directly linked to a report in EDW project
Filter(
REPORT_OBJECT_LINK,
Report_Id in Filter(
REPORT_DETAIL,
// delegation warning should be okay since there shouldn't be > 2,000 reports for a single project
EDW_Project = ProjectPicker_1.Selected.Result
).Report_Id
).Object_Id Or// in any part of an object lineage for an object that is directly linked to a report in EDW project
Object_Id in// Level 1
Filter(
OBJECT_LEVEL_LINEAGE,
Master_Object_Id in
// make sure Master Object directly linked to report in EDW project
Filter(
REPORT_OBJECT_LINK,
Report_Id in Filter(
REPORT_DETAIL,
// delegation warning should be okay since there shouldn't be > 2,000 reports for a single project
EDW_Project = ProjectPicker_1.Selected.Result
).Report_Id
).Object_Id
).Level1_Object_Id Or Object_Id in// Level 2
Filter(
OBJECT_LEVEL_LINEAGE,
Master_Object_Id in
// directly linked to a report
Filter(
REPORT_OBJECT_LINK,
Report_Id in Filter(
REPORT_DETAIL,
// delegation warning should be okay since there shouldn't be > 2,000 reports for a single project
EDW_Project = ProjectPicker_1.Selected.Result
).Report_Id
).Object_Id
).Level2_Object_Id Or Object_Id in// Level 3
// object in a lineage that is linked to a report
Filter(
OBJECT_LEVEL_LINEAGE,
Master_Object_Id in
// directly linked to a report
Filter(
REPORT_OBJECT_LINK,
Report_Id in Filter(
REPORT_DETAIL,
// delegation warning should be okay since there shouldn't be > 2,000 reports for a single project
EDW_Project = ProjectPicker_1.Selected.Result
).Report_Id
).Object_Id
).Level3_Object_Id Or Object_Id in// Level 4
// object in a lineage that is linked to a report
Filter(
OBJECT_LEVEL_LINEAGE,
Master_Object_Id in
// directly linked to a report
Filter(
REPORT_OBJECT_LINK,
Report_Id in Filter(
REPORT_DETAIL,
// delegation warning should be okay since there shouldn't be > 2,000 reports for a single project
EDW_Project = ProjectPicker_1.Selected.Result
).Report_Id
).Object_Id
).Level4_Object_Id Or Object_Id in// Level 5
// object in a lineage that is linked to a report
Filter(
OBJECT_LEVEL_LINEAGE,
Master_Object_Id in
// directly linked to a report
Filter(
REPORT_OBJECT_LINK,
Report_Id in Filter(
REPORT_DETAIL,
// delegation warning should be okay since there shouldn't be > 2,000 reports for a single project
EDW_Project = ProjectPicker_1.Selected.Result
).Report_Id
).Object_Id
).Level5_Object_Id Or Object_Id in// Level 6
// object in a lineage that is linked to a report
Filter(
OBJECT_LEVEL_LINEAGE,
Master_Object_Id in
// directly linked to a report
Filter(
REPORT_OBJECT_LINK,
Report_Id in Filter(
REPORT_DETAIL,
// delegation warning should be okay since there shouldn't be > 2,000 reports for a single project
EDW_Project = ProjectPicker_1.Selected.Result
).Report_Id
).Object_Id
).Level6_Object_Id Or Object_Id in// Root
// object in a lineage that is linked to a report
Filter(
OBJECT_LEVEL_LINEAGE,
Master_Object_Id in
// directly linked to a report
Filter(
REPORT_OBJECT_LINK,
Report_Id in Filter(
REPORT_DETAIL,
// delegation warning should be okay since there shouldn't be > 2,000 reports for a single project
EDW_Project = ProjectPicker_1.Selected.Result
).Report_Id
).Object_Id
).Root_Source_Object_Id Or//Object is EDW object mapped to a root object in a lineage for an object directly linked to report in EDW project
Object_Id in// EDW Mapping
Filter(
EDW_TO_ROOT_OBJECT_MAP,
Root_Source_Object_Id in
// lineage where master object directly linked to report
Filter(
OBJECT_LEVEL_LINEAGE,
Master_Object_Id in
// directly linked to a report
Filter(
REPORT_OBJECT_LINK,
Report_Id in Filter(
REPORT_DETAIL,
// delegation warning should be okay since there shouldn't be > 2,000 reports for a single project
EDW_Project = ProjectPicker_1.Selected.Result
).Report_Id
).Object_Id
).Root_Source_Object_Id
).EDW_Object_Id
)
/*-------------------- end code block to filter objects by edw project -----------------*/,
box_Source_Object_Search.Text,
"Object_Combined_Name"
),
Object_Combined_Name
),
{
Object_Id: Object_Id,
Object_Name: Object_Name,
Object_Type: Object_Type,
Server: Server,
Database: Database,
Schema: Schema,
Object_Combined_Name: Object_Combined_Name,
Obsolete_Code: Obsolete_Code,
Reported_Code: Reported_Code,
Notes: Notes,
Created_Person_Id: Created_Person_Id,
Created_Ts: Created_Ts,
Last_Updated_Person_Id: Last_Updated_Person_Id,
Last_Updated_Ts: Last_Updated_Ts
}
),
If(
NoLineages,
ForAll(
Sort(
Search(
/*-------------------- begin code block to filter objects by edw project -----------------*/
Filter(
OBJECT_DETAIL_MISSING_LINEAGES,
Object_Id in
// directly linked to a report in EDW project
Filter(
REPORT_OBJECT_LINK,
Report_Id in Filter(
REPORT_DETAIL,
// delegation warning should be okay since there shouldn't be > 2,000 reports for a single project
EDW_Project = ProjectPicker_1.Selected.Result
).Report_Id
).Object_Id Or// in any part of an object lineage for an object that is directly linked to a report in EDW project
Object_Id in// Level 1
Filter(
OBJECT_LEVEL_LINEAGE,
Master_Object_Id in
// make sure Master Object directly linked to report in EDW project
Filter(
REPORT_OBJECT_LINK,
Report_Id in Filter(
REPORT_DETAIL,
// delegation warning should be okay since there shouldn't be > 2,000 reports for a single project
EDW_Project = ProjectPicker_1.Selected.Result
).Report_Id
).Object_Id
).Level1_Object_Id Or Object_Id in// Level 2
Filter(
OBJECT_LEVEL_LINEAGE,
Master_Object_Id in
// directly linked to a report
Filter(
REPORT_OBJECT_LINK,
Report_Id in Filter(
REPORT_DETAIL,
// delegation warning should be okay since there shouldn't be > 2,000 reports for a single project
EDW_Project = ProjectPicker_1.Selected.Result
).Report_Id
).Object_Id
).Level2_Object_Id Or Object_Id in// Level 3
// object in a lineage that is linked to a report
Filter(
OBJECT_LEVEL_LINEAGE,
Master_Object_Id in
// directly linked to a report
Filter(
REPORT_OBJECT_LINK,
Report_Id in Filter(
REPORT_DETAIL,
// delegation warning should be okay since there shouldn't be > 2,000 reports for a single project
EDW_Project = ProjectPicker_1.Selected.Result
).Report_Id
).Object_Id
).Level3_Object_Id Or Object_Id in// Level 4
// object in a lineage that is linked to a report
Filter(
OBJECT_LEVEL_LINEAGE,
Master_Object_Id in
// directly linked to a report
Filter(
REPORT_OBJECT_LINK,
Report_Id in Filter(
REPORT_DETAIL,
// delegation warning should be okay since there shouldn't be > 2,000 reports for a single project
EDW_Project = ProjectPicker_1.Selected.Result
).Report_Id
).Object_Id
).Level4_Object_Id Or Object_Id in// Level 5
// object in a lineage that is linked to a report
Filter(
OBJECT_LEVEL_LINEAGE,
Master_Object_Id in
// directly linked to a report
Filter(
REPORT_OBJECT_LINK,
Report_Id in Filter(
REPORT_DETAIL,
// delegation warning should be okay since there shouldn't be > 2,000 reports for a single project
EDW_Project = ProjectPicker_1.Selected.Result
).Report_Id
).Object_Id
).Level5_Object_Id Or Object_Id in// Level 6
// object in a lineage that is linked to a report
Filter(
OBJECT_LEVEL_LINEAGE,
Master_Object_Id in
// directly linked to a report
Filter(
REPORT_OBJECT_LINK,
Report_Id in Filter(
REPORT_DETAIL,
// delegation warning should be okay since there shouldn't be > 2,000 reports for a single project
EDW_Project = ProjectPicker_1.Selected.Result
).Report_Id
).Object_Id
).Level6_Object_Id Or Object_Id in// Root
// object in a lineage that is linked to a report
Filter(
OBJECT_LEVEL_LINEAGE,
Master_Object_Id in
// directly linked to a report
Filter(
REPORT_OBJECT_LINK,
Report_Id in Filter(
REPORT_DETAIL,
// delegation warning should be okay since there shouldn't be > 2,000 reports for a single project
EDW_Project = ProjectPicker_1.Selected.Result
).Report_Id
).Object_Id
).Root_Source_Object_Id Or//Object is EDW object mapped to a root object in a lineage for an object directly linked to report in EDW project
Object_Id in// EDW Mapping
Filter(
EDW_TO_ROOT_OBJECT_MAP,
Root_Source_Object_Id in
// lineage where master object directly linked to report
Filter(
OBJECT_LEVEL_LINEAGE,
Master_Object_Id in
// directly linked to a report
Filter(
REPORT_OBJECT_LINK,
Report_Id in Filter(
REPORT_DETAIL,
// delegation warning should be okay since there shouldn't be > 2,000 reports for a single project
EDW_Project = ProjectPicker_1.Selected.Result
).Report_Id
).Object_Id
).Root_Source_Object_Id
).EDW_Object_Id
)
/*-------------------- end code block to filter objects by edw project -----------------*/,
box_Source_Object_Search.Text,
"Object_Combined_Name"
),
Object_Combined_Name
),
{
Object_Id: Object_Id,
Object_Name: Object_Name,
Object_Type: Object_Type,
Server: Server,
Database: Database,
Schema: Schema,
Object_Combined_Name: Object_Combined_Name,
Obsolete_Code: Obsolete_Code,
Reported_Code: Reported_Code,
Notes: Notes,
Created_Person_Id: Created_Person_Id,
Created_Ts: Created_Ts,
Last_Updated_Person_Id: Last_Updated_Person_Id,
Last_Updated_Ts: Last_Updated_Ts
}
),
ForAll(
Sort(
// search for OBJECT_DETAIL records matching the search bar text on Object_Combined_Name and in EDW project
Search(
/*-------------------- begin code block to filter objects by edw project -----------------*/
Filter(
OBJECT_DETAIL,
Object_Id in
// directly linked to a report in EDW project
Filter(
REPORT_OBJECT_LINK,
Report_Id in Filter(
REPORT_DETAIL,
// delegation warning should be okay since there shouldn't be > 2,000 reports for a single project
EDW_Project = ProjectPicker_1.Selected.Result
).Report_Id
).Object_Id Or// in any part of an object lineage for an object that is directly linked to a report in EDW project
Object_Id in// Level 1
Filter(
OBJECT_LEVEL_LINEAGE,
Master_Object_Id in
// make sure Master Object directly linked to report in EDW project
Filter(
REPORT_OBJECT_LINK,
Report_Id in Filter(
REPORT_DETAIL,
// delegation warning should be okay since there shouldn't be > 2,000 reports for a single project
EDW_Project = ProjectPicker_1.Selected.Result
).Report_Id
).Object_Id
).Level1_Object_Id Or Object_Id in// Level 2
Filter(
OBJECT_LEVEL_LINEAGE,
Master_Object_Id in
// directly linked to a report
Filter(
REPORT_OBJECT_LINK,
Report_Id in Filter(
REPORT_DETAIL,
// delegation warning should be okay since there shouldn't be > 2,000 reports for a single project
EDW_Project = ProjectPicker_1.Selected.Result
).Report_Id
).Object_Id
).Level2_Object_Id Or Object_Id in// Level 3
// object in a lineage that is linked to a report
Filter(
OBJECT_LEVEL_LINEAGE,
Master_Object_Id in
// directly linked to a report
Filter(
REPORT_OBJECT_LINK,
Report_Id in Filter(
REPORT_DETAIL,
// delegation warning should be okay since there shouldn't be > 2,000 reports for a single project
EDW_Project = ProjectPicker_1.Selected.Result
).Report_Id
).Object_Id
).Level3_Object_Id Or Object_Id in// Level 4
// object in a lineage that is linked to a report
Filter(
OBJECT_LEVEL_LINEAGE,
Master_Object_Id in
// directly linked to a report
Filter(
REPORT_OBJECT_LINK,
Report_Id in Filter(
REPORT_DETAIL,
// delegation warning should be okay since there shouldn't be > 2,000 reports for a single project
EDW_Project = ProjectPicker_1.Selected.Result
).Report_Id
).Object_Id
).Level4_Object_Id Or Object_Id in// Level 5
// object in a lineage that is linked to a report
Filter(
OBJECT_LEVEL_LINEAGE,
Master_Object_Id in
// directly linked to a report
Filter(
REPORT_OBJECT_LINK,
Report_Id in Filter(
REPORT_DETAIL,
// delegation warning should be okay since there shouldn't be > 2,000 reports for a single project
EDW_Project = ProjectPicker_1.Selected.Result
).Report_Id
).Object_Id
).Level5_Object_Id Or Object_Id in// Level 6
// object in a lineage that is linked to a report
Filter(
OBJECT_LEVEL_LINEAGE,
Master_Object_Id in
// directly linked to a report
Filter(
REPORT_OBJECT_LINK,
Report_Id in Filter(
REPORT_DETAIL,
// delegation warning should be okay since there shouldn't be > 2,000 reports for a single project
EDW_Project = ProjectPicker_1.Selected.Result
).Report_Id
).Object_Id
).Level6_Object_Id Or Object_Id in// Root
// object in a lineage that is linked to a report
Filter(
OBJECT_LEVEL_LINEAGE,
Master_Object_Id in
// directly linked to a report
Filter(
REPORT_OBJECT_LINK,
Report_Id in Filter(
REPORT_DETAIL,
// delegation warning should be okay since there shouldn't be > 2,000 reports for a single project
EDW_Project = ProjectPicker_1.Selected.Result
).Report_Id
).Object_Id
).Root_Source_Object_Id Or//Object is EDW object mapped to a root object in a lineage for an object directly linked to report in EDW project
Object_Id in// EDW Mapping
Filter(
EDW_TO_ROOT_OBJECT_MAP,
Root_Source_Object_Id in
// lineage where master object directly linked to report
Filter(
OBJECT_LEVEL_LINEAGE,
Master_Object_Id in
// directly linked to a report
Filter(
REPORT_OBJECT_LINK,
Report_Id in Filter(
REPORT_DETAIL,
// delegation warning should be okay since there shouldn't be > 2,000 reports for a single project
EDW_Project = ProjectPicker_1.Selected.Result
).Report_Id
).Object_Id
).Root_Source_Object_Id
).EDW_Object_Id
)
/*-------------------- end code block to filter objects by edw project -----------------*/,
box_Source_Object_Search.Text,
"Object_Combined_Name"
),
Object_Combined_Name
),
{
Object_Id: Object_Id,
Object_Name: Object_Name,
Object_Type: Object_Type,
Server: Server,
Database: Database,
Schema: Schema,
Object_Combined_Name: Object_Combined_Name,
Obsolete_Code: Obsolete_Code,
Reported_Code: Reported_Code,
Notes: Notes,
Created_Person_Id: Created_Person_Id,
Created_Ts: Created_Ts,
Last_Updated_Person_Id: Last_Updated_Person_Id,
Last_Updated_Ts: Last_Updated_Ts
}
)
)
)
)
)
},
// iterate through each generated number
ForAll(
// genereates a sequence of numbers in the range of the number of Objects
Sequence(CountRows(Objects)),
// add a RowNo to each Object record - this allows for dynamic, alternate colors in the gallery based on RowNo
Patch(
Last(
FirstN(
Objects,
Value
)
),
{RowNo: Value}
)
)
)