cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Oos
Advocate V
Advocate V

Component button using 12 times. Need output which button is clicked on the first screen

I'm having a component with a button and i use this component 12 times at the first screen. On a later screen do i want to know which button of these 12 is clicked latest. 

I already tried to create a variable on the OnSelect in the button (in component). But I cant use this variable in a screen (doenst recognize).
Set(LatestClickedButton; Component.Text)

Does anyone has a solution? Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
K-A-R-L
Solution Specialist
Solution Specialist

Hi @Oos ,

 

Try Collecting the selected Buttons (CollectedButton) with a TimeStamp > Sort Collection by column TimeStamp > Set the Last Item on the Collection Set(LastesClickedButton, Last(CollectedButtons).ComponentTextColumn)

 

Please let me know if you need help with this.

Thanks,
K-A-R-L


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

2 REPLIES 2
K-A-R-L
Solution Specialist
Solution Specialist

Hi @Oos ,

 

Try Collecting the selected Buttons (CollectedButton) with a TimeStamp > Sort Collection by column TimeStamp > Set the Last Item on the Collection Set(LastesClickedButton, Last(CollectedButtons).ComponentTextColumn)

 

Please let me know if you need help with this.

Thanks,
K-A-R-L


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

v-xida-msft
Community Support
Community Support

Hi @Oos ,

Do you custom a Component control within your app?

Do you want to reference the variable set/initialized within the Component control in your app screen?

 

If you want to reference the variable set/initialized within the Component control in your app screen, you must define a Output property within your Component control, then bind the variable to the Output property in your Component control.

More details about defined a Output property within a Component control, please check the following GIF screenshot:Test.gif

On your side, you should defined a Output property (called "LatestClickedButtonValue") within your Component control above above screenshot.

Set the OnSelect property of the Button within the Component control to following:

Set(LatestClickedButton, Button1.Text)

Then within "Advanced" tab -> "Data" part, set the LatestClickedButtonValue (Output) property to following:

LatestClickedButton

After that, when you insert the Component control into your screen, you could reference the variable through the LatestClickedButtonValue (Output) property of the Component control using the following formula:

Component1_1.LatestClickedButtonValue

1.JPG

 

More details about the Output property of a Component control, please check the following article:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/create-component#custom-properties

 

Please consider take a try with above solution, then check if the issue is solved.

 

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.

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Top Solution Authors
Top Kudoed Authors
Users online (1,343)