cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Tyrrell94
Frequent Visitor

Set variable not working

Hi, 

 

I am working on my first PowerApp, I have never done anything like this before so I am trying to learn as I go along. 

 

I am trying to pass details from a form onto the next page through variables. I already had this working, but I have had to revisit it and add another variable. 

 

The OnSelect. of the form contains: 

 

Set({selectedIssueNO : ThisItem.TicketKey, selectedSubject : ThisItem.Subject, selectedDescription : ThisItem.Description, selectedAssignedTo2 : ThisItem.AssignedTo}) ; UpdateContext({selColor : RGBA(255, 0, 0, 1)}) 

 

This was working at first, but now when I have tried to add another variable PowerApps is not picking up the new variable. 

 

Set({ selectedIssueNo : ThisItem.TicketKey , selectedSubject : ThisItem.Subject , selectedDescription : ThisItem.Description , selectedAssignedTo : ThisItem.AssignedTo}) 

 

The last variable 'selectedAssignedTo' will not set, and I can't figure out why. 

 

I have added a label on the same screen and set the text as 'selectedAssignedTo' but the variable is not appearing in the list, and coming back with a 'Name isn't valid' error. 

 

Any help would be appreciated, I have been scratching my head over this for a while. 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
v-xida-msft
Community Support
Community Support

Hi @Tyrrell94,

Does the first formula that you provided work well within your app?

 

Based on the formula that you provided, I think there is something wrong with the Set function within the formula that you provided.

The standard formula format of the Set function as below:

Set( VariableName, Value )

On your side, you should modify your formula within the OnSelect property of a Button control  (or other controls) as below:

Set(
CurrentRecord,
{
selectedIssueNO : ThisItem.TicketKey,
selectedSubject : ThisItem.Subject,
selectedDescription : ThisItem.Description,
selectedAssignedTo2 : ThisItem.AssignedTo
}
);
UpdateContext({selColor : RGBA(255, 0, 0, 1)})

If you want to reference the selectedAssignedTo2 property, you should type the following formula (e.g. Set Text property of a Label control to following):

CurrentRecord.selectedAssignedTo2

More details about the Set function within PowerApps, please check the following article:

Set function

 

Best regards,

Kris

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

3 REPLIES 3
v-xida-msft
Community Support
Community Support

Hi @Tyrrell94,

Does the first formula that you provided work well within your app?

 

Based on the formula that you provided, I think there is something wrong with the Set function within the formula that you provided.

The standard formula format of the Set function as below:

Set( VariableName, Value )

On your side, you should modify your formula within the OnSelect property of a Button control  (or other controls) as below:

Set(
CurrentRecord,
{
selectedIssueNO : ThisItem.TicketKey,
selectedSubject : ThisItem.Subject,
selectedDescription : ThisItem.Description,
selectedAssignedTo2 : ThisItem.AssignedTo
}
);
UpdateContext({selColor : RGBA(255, 0, 0, 1)})

If you want to reference the selectedAssignedTo2 property, you should type the following formula (e.g. Set Text property of a Label control to following):

CurrentRecord.selectedAssignedTo2

More details about the Set function within PowerApps, please check the following article:

Set function

 

Best regards,

Kris

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

Hi Kirs, 

 

You had been right, I just had the syntax wrong. 

 

I have now changed it to the following and it works fine. 

 

Set(selectedAssignedTo , ThisItem.AssignedTo) 

 

Thanks for your response! 

 

Regards,

Andrew

vffdd
Responsive Resident
Responsive Resident

 

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza Winner Announcement

Please join us on Wednesday, July 21st at 8a PDT. We will be announcing the Winners of the Demo Extravaganza!

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (2,679)