cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mattpadge24
Regular Visitor

SQL trigger alternative in powerapps

hi, I have an app where I want the database to log the time it was used, what parts of the app was used etc so I can use power bi to do some analytics (im aware PowerApps has built in analytics but im a student and my lecturer told me I need to do my own) as PowerApps doesn't allow triggers to be used is there an alternative?

 

thanks,

 

matt

1 ACCEPTED SOLUTION

Accepted Solutions
v-xida-msft
Community Support
Community Support

Hi @mattpadge24 ,

Yeah, you are right. The SQL Trigger is not supported in PowerApps currently. As an alternative solution, you could consider add a "Log" button in your canvas app.

 

When you want to create a new log in your data source (SQL Table), you could press the "Log" button. Within the "Log" button, you could execute a Patch function to push data (that you want to log) back to your SQL Table.

Set the OnSelect property of the "Log" button to following:

Patch(
      '[dbo].[SQLTable]',
      Defaults('[dbo].[SQLTable]'),
      {
        LogTime: Now(),
        LogPart: "xxxxx",
        ....
      }
)

Note: The LogTime, LogPart, .. are all columns in your SQL Table.

 

Within your Power BI, you could create a report based on your SQL Table dataset, then you could so some analytics.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-xida-msft
Community Support
Community Support

Hi @mattpadge24 ,

Yeah, you are right. The SQL Trigger is not supported in PowerApps currently. As an alternative solution, you could consider add a "Log" button in your canvas app.

 

When you want to create a new log in your data source (SQL Table), you could press the "Log" button. Within the "Log" button, you could execute a Patch function to push data (that you want to log) back to your SQL Table.

Set the OnSelect property of the "Log" button to following:

Patch(
      '[dbo].[SQLTable]',
      Defaults('[dbo].[SQLTable]'),
      {
        LogTime: Now(),
        LogPart: "xxxxx",
        ....
      }
)

Note: The LogTime, LogPart, .. are all columns in your SQL Table.

 

Within your Power BI, you could create a report based on your SQL Table dataset, then you could so some analytics.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Users online (2,564)