Hi,
I have the following tables: REPORT_DETAIL, OBJECT_DETAIL, REPORT_OBJECT_LINK, OBJECT_LEVEL_LINEAGE, EDW_TO_ROOT_OBJECT_MAP.
The model is:
I have a gallery to display records in OBJECT_DETAIL and I am filtering this gallery based on a dropdown of EDW_Project_Names. When an EDW_Project_Name is selected from the dropdown and the value is NOT "TBD", I want object records to display if:
1) they are directly linked to a Report record in REPORT_DETAIL for which the EDW_Project is the EDW_Project_Name
2) they appear anywhere in an OBJECT_LEVEL_LINEAGE record for which the Master_Object_Id of the lineage is associated to an object that is directly tied to a Report record for which the EDW_Project is the EDW_Project_Name
3) It is an EDW_Object_Id associated mapped to a Root_Source_Object_Id where the Root_Source_Object_Id is the Root_Object_Id for a record in OBJECT_LEVEL_LINEAGE for which the Master_Object_Id of the lineage is associated to an object that is directly tied to a Report record for which the EDW_Project is the EDW_Project_Name.
Additionally, I have a selection of radio buttons that, depending on which is selected, the data source changes (ie OBJECT_DETAIL vs OBJECT_DETAIL_ROOTS).
I know that I can create a SQL Server stored proc and pass in the parameter of Edw_Project_Name, but this would involve Power Automate and be a Premium feature. I am trying to avoid using that feature.
I have written the below code and it works, but is EXTREMELY slow and I'm sure very inefficient, as there are a lot of repetitive chunks. I am looking for suggestions on how to optimize this code.
If the value is "TBD", then I display all Object records from OBJECT_DETAIL that are NOT tied to any Reports or Objects through any of the above relations. This logic is achieved with a SQL view since it is a static query and does not require any parameters or stored proc flows.
I would also like to have alternate row coloring, which is why everything is wrapped in the ForAll with the RowNo patch.
Solved! Go to Solution.
I ended up just using SQL Server stored procs and Power Apps Flows to achieve what I was trying to do. Way more efficient and run times reduced from ~11,000 ms to ~700 ms.
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}
)
)
)
Oh boy, I will do my best here, could you please share the same in a file formatted please?
Some additional questions,
--where is this hosted? looks like SQL server, if so the power app would be considered Premium
--if hosted in SQL DB, would you be able to create additional views if required? (not that I'm considering this, but I need to know)
@Anonymous
Just wanted to let you know that I am reviewing your formula. It is *extremely* overcomplicated and can be reduced to just a few lines. But, I need to review it thoroughly to grasp what you are doing.
You are repeating so many functions over and over on the same data - this is not only a nightmare to maintain, but will be highly inefficient.
Give me some "digesting" time on it.
@Anonymous
Can you provide more details on the following:
- OBJECT_DETAILS_ROOTS (Is this the Object_Details table? Not seeing it in your model)
- Roots
- RootsNoEDW
- NoLIneages
- The Items property of ProjectPicker_1
Hi @RandyHayes. Thanks for giving this your consideration.
OBJECT_DETAILS_ROOTS is a view of the OBJECT_DETAIL table that only selects records where the Object_Ids appear at the Root level of an Object Lineage in the OBJECT_LEVEL_LINEAGE table. It's essentially:
SELECT *
FROM OBJECT_DETAIL d WITH(NOLOCK)
WHERE d.Object_Id IN (
SELECT OBJECT_Id
FROM OBJECT_DETAIL d WITH(NOLOCK)
INTERSECT
SELECT l.Root_Source_Object_Id
FROM OBJECT_LEVEL_LINEAGE l WITH(NOLOCK)
)
Roots, RootsNoEDW, and NoLineages are all booleans triggered true/false depending on the radio button selection by the user. Similar to how OBJECT_DETAIL_ROOTS was created, OBJECT_DETAIL_ROOTS_MISSING_EDW_EQUIVALENTS becomes the data source if RootsNoEDW is true to show Object records from OBJECT_DETAIL_ROOTS where there are no Root_Source_Object_Id matches in EDW_TO_ROOT_OBJECT_MAP. This view query is:
SELECT *
FROM OBJECT_DETAIL WITH(NOLOCK)
-- GET ROOT OBJECTS ONLY
WHERE OBJECT_ID IN (
SELECT OBJECT_ID
FROM OBJECT_DETAIL WITH(NOLOCK)
INTERSECT
SELECT Root_Source_Object_Id
FROM OBJECT_LEVEL_LINEAGE WITH(NOLOCK))
AND
-- GET OBJECTS WITHOUT EDW EQUIVALENTS
OBJECT_ID IN (
SELECT OBJECT_ID
FROM OBJECT_DETAIL WITH(NOLOCK)
EXCEPT
SELECT Root_Source_Object_Id
FROM EDW_TO_ROOT_OBJECT_MAP WITH(NOLOCK)
)
NoLineages is similar to the above but selects a subset from OBJECT_DETAIL where there are no related records in OBJECT_LEVEL_LINEAGE. the view query is:
select *
from OBJECT_DETAIL with(nolock)
where object_id in (
select Object_Id
from object_detail with(nolock)
except
select Master_Object_Id
from OBJECT_LEVEL_LINEAGE with(nolock)
)
The Items property of ProjectPicker_1 is EDW_PROJECT.EDW_Project_Name.
Hi @Anonymous. Thanks for looking at this. I've saved the code as a .docx and attached it.
This is hosted on SQL Server. It is a Premium Power App but I am trying to avoid using Power Automate and stored proc flows if at all possible.
I am able to crate additional views if required.
Thanks.
I ended up just using SQL Server stored procs and Power Apps Flows to achieve what I was trying to do. Way more efficient and run times reduced from ~11,000 ms to ~700 ms.
Dear Community Members, We'd like to let you know of an upcoming change to the community platform: starting July 16th, the platform will transition to a READ ONLY mode until July 22nd. During this period, members will not be able to Kudo, Comment, or Reply to any posts. On July 22nd, please be on the lookout for a message sent to the email address registered on your community profile. This email is crucial as it will contain your unique code and link to register for the new platform encompassing all of the communities. What to Expect in the New Community: A more unified experience where all products, including Power Apps, Power Automate, Copilot Studio, and Power Pages, will be accessible from one community.Community Blogs that you can syndicate and link to for automatic updates. We appreciate your understanding and cooperation during this transition. Stay tuned for the exciting new features and a seamless community experience ahead!
We are excited to announce the Summer of Solutions Challenge! This challenge is kicking off on Monday, June 17th and will run for (4) weeks. The challenge is open to all Power Platform (Power Apps, Power Automate, Copilot Studio & Power Pages) community members. We invite you to participate in a quest to provide solutions in the Forums to as many questions as you can. Answers can be provided in all the communities. Entry Period: This Challenge will consist of four weekly Entry Periods as follows (each an “Entry Period”) - 12:00 a.m. PT on June 17, 2024 – 11:59 p.m. PT on June 23, 2024 - 12:00 a.m. PT on June 24, 2024 – 11:59 p.m. PT on June 30, 2024 - 12:00 a.m. PT on July 1, 2024 – 11:59 p.m. PT on July 7, 2024 - 12:00 a.m. PT on July 8, 2024 – 11:59 p.m. PT on July 14, 2024 Entries will be eligible for the Entry Period in which they are received and will not carryover to subsequent weekly entry periods. You must enter into each weekly Entry Period separately. How to Enter: We invite you to participate in a quest to provide "Accepted Solutions" to as many questions as you can. Answers can be provided in all the communities. Users must provide a solution which can be an “Accepted Solution” in the Forums in all of the communities and there are no limits to the number of “Accepted Solutions” that a member can provide for entries in this challenge, but each entry must be substantially unique and different. Winner Selection and Prizes: At the end of each week, we will list the top ten (10) Community users which will consist of: 5 Community Members & 5 Super Users and they will advance to the final drawing. We will post each week in the News & Announcements the top 10 Solution providers. At the end of the challenge, we will add all of the top 10 weekly names and enter them into a random drawing. Then we will randomly select ten (10) winners (5 Community Members & 5 Super Users) from among all eligible entrants received across all weekly Entry Periods to receive the prize listed below. If a winner declines, we will draw again at random for the next winner. A user will only be able to win once overall. If they are drawn multiple times, another user will be drawn at random. Individuals will be contacted before the announcement with the opportunity to claim or deny the prize. Once all of the winners have been notified, we will post in the News & Announcements of each community with the list of winners. Each winner will receive one (1) Pass to the Power Platform Conference in Las Vegas, Sep. 18-20, 2024 ($1800 value). NOTE: Prize is for conference attendance only and any other costs such as airfare, lodging, transportation, and food are the sole responsibility of the winner. Tickets are not transferable to any other party or to next year’s event. ** PLEASE SEE THE ATTACHED RULES for this CHALLENGE** Week 1 Results: Congratulations to the Week 1 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Community MembersNumber of SolutionsSuper UsersNumber of Solutions @anandm08 23 @WarrenBelz 31 @DBO_DV 10 @Amik 19 AmínAA 6 @mmbr1606 12 @rzuber 4 @happyume 7 @Giraldoj 3@ANB 6 (tie) @SpongYe 6 (tie) Week 2 Results: Congratulations to the Week 2 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Community MembersSolutionsSuper UsersSolutions @anandm08 10@WarrenBelz 25 @DBO_DV 6@mmbr1606 14 @AmínAA 4 @Amik 12 @royg 3 @ANB 10 @AllanDeCastro 2 @SunilPashikanti 5 @Michaelfp 2 @FLMike 5 @eduardo_izzo 2 Meekou 2 @rzuber 2 @Velegandla 2 @PowerPlatform-P 2 @Micaiah 2 Week 3 Results: Congratulations to the Week 3 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 3:Community MembersSolutionsSuper UsersSolutionsPower Apps anandm0861WarrenBelz86DBO_DV25Amik66Michaelfp13mmbr160647Giraldoj13FLMike31AmínAA13SpongYe27 Week 4 Results: Congratulations to the Week 4 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 4:Community MembersSolutionsSuper UsersSolutionsPower Apps DBO-DV21WarranBelz26Giraldoj7mmbr160618Muzammmil_0695067Amik14samfawzi_acml6FLMike12tzuber6ANB8 SunilPashikanti8
On July 16, 2024, we published the 2024 release wave 2 plans for Microsoft Dynamics 365 and Microsoft Power Platform. These plans are a compilation of the new capabilities planned to be released between October 2024 to March 2025. This release introduces a wealth of new features designed to enhance customer understanding and improve overall user experience, showcasing our dedication to driving digital transformation for our customers and partners. The upcoming wave is centered around utilizing advanced AI and Microsoft Copilot technologies to enhance user productivity and streamline operations across diverse business applications. These enhancements include intelligent automation, AI-powered insights, and immersive user experiences that are designed to break down barriers between data, insights, and individuals. Watch a summary of the release highlights. Discover the latest features that empower organizations to operate more efficiently and adaptively. From AI-driven sales insights and customer service enhancements to predictive analytics in supply chain management and autonomous financial processes, the new capabilities enable businesses to proactively address challenges and capitalize on opportunities.
We're embarking on a journey to enhance your experience by transitioning to a new community platform. Our team has been diligently working to create a fresh community site, leveraging the very Dynamics 365 and Power Platform tools our community advocates for. We started this journey with transitioning Copilot Studio forums and blogs in June. The move marks the beginning of a new chapter, and we're eager for you to be a part of it. The rest of the Power Platform product sites will be moving over this summer. Stay tuned for more updates as we get closer to the launch. We can't wait to welcome you to our new community space, designed with you in mind. Let's connect, learn, and grow together. Here's to new beginnings and endless possibilities! If you have any questions, observations or concerns throughout this process please go to https://aka.ms/PPCommSupport. To stay up to date on the latest details of this migration and other important Community updates subscribe to our News and Announcements forums: Copilot Studio, Power Apps, Power Automate, Power Pages