web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Populating a variable ...
Power Apps
Answered

Populating a variable from selected gallery item

(0) ShareShare
ReportReport
Posted on by 356

Having a small issue with this.  Trying to do the following:

Officer needs to create supplemental report.  New report number will be Title&-"S"

When officer clicks on create supplemental report, he will go to a new form but the Title card needs to have a default of selected gallery item's Title&-"S"

 

Example below, new title card default would be S201H-001-S.

 

Any takers?

SuppCapture.JPG

Categories:
I have the same question (0)
  • mdevaney Profile Picture
    29,989 Moderator on at

    @slhangen 

    Please share the error message you are receiving.  This is the most important piece of information.

     

    Is your button inside the gallery?  This might be the case because PowerApps does not recognize ThisItem.

     

    Did you put this code in the OnSelect property of the button?

     

    Set(varSupplementalNumber, ThisItem.Title&”-S”)

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

  • slhangen Profile Picture
    356 on at

    Is your button inside the gallery? Yes

     

    This might be the case because PowerApps does not recognize ThisItem.

     

    Did you put this code in the OnSelect property of the button? Yes

     

    Set(varSupplementalNumber, ThisItem.Title&”-S”)

     

    Is there a better way to do this?

  • slhangen Profile Picture
    356 on at

    Is your button inside the gallery? Yes

    This might be the case because PowerApps does not recognize ThisItem.

    Did you put this code in the OnSelect property of the button? Yes

    Set(varSupplementalNumber, ThisItem.Title&”-S”)

     

    Is there a better way to do this?

  • mdevaney Profile Picture
    29,989 Moderator on at

    @slhangen 

    I still want to see that error message.  Please share it.

  • slhangen Profile Picture
    356 on at

    Capture.JPG

  • Verified answer
    mdevaney Profile Picture
    29,989 Moderator on at

    @slhangen 
    I believe this error is being caused by setting the same variable as 2 different types.  You can only use SET or UPDATECONTEXT for a variable name.  varSupplementalNumber cannot be used both ways.  Pick 1. 


    Set(varSupplementalNumber, ...)

    UpdateContext({varSupplementalNumber: ...)

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

  • slhangen Profile Picture
    356 on at

    Thx so much.  I got it. The button was sitting outside the gallery item.  Facepalm!!!

    One more thing, I would like the button to open up a supplemental report based on original report. Can I populate the new form with some of the data from the original report? The original report contents need to be duplicated while other cards such as narrative need to be blank.

    Thx again.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard