Skip to content
Home » Copy function in Power Apps

Copy function in Power Apps

The Copy() function in Power Apps is used to copy text values to the clipboard, allowing users to easily paste them elsewhere. Regardless of the contents of the text, the clipboard will contain plain text without any special mime type. The function is considered a side-effects function and as a result it can only be used in behavior properties.




Syntax:

Copy(Text)
  • Text – Required. The text string that will be copied to the clipboard.

 

Usages of Copy function

Example 1: Copy a Value from a Label

To copy the value displayed in the lblMessage label when a button is clicked.

Set the following code in the OnSelect property of the button.

Copy(lblMessage.Text)

Now, when the button is clicked, the text from lblMessage is copied to the clipboard.

Example 2: Copy a Value from a Gallery

Assume you have a Gallery (GalleryBook) displaying a list of items, and you want to copy the text from the lblTitle label when a button is clicked.

First, add a button to your gallery and set the following code in the OnSelect property of the button.

Copy(GalleryBook.Selected.lblTitle.Text)

When you click on Copy button it copies the Title of the selected item in the gallery.

Example 3: Copy Multiple Values

To copy multiple values together, you can concatenate them before copying.

Let’s modify the previous formula (Example 2) to copy multiple values at once.

Copy("Title:" & GalleryBook.Selected.lblTitle.Text & 
"| Status Reason:" & GalleryBook.Selected.'Status Reason')

Now, when you click on Copy button, it copies the Title and Status Reason of the selected item in the gallery.




Recommended for you

Loading

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from SQL BI Tutorials

Subscribe now to keep reading and get access to the full archive.

Continue reading