cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Issue with the new Set() function

I have been using the set() function to maintain a global variable in a multiscreen app. The variable is text and is set from the itemselected operator from a gallery as well as strings...

 

eg

 

1. Set(AuditTypePerformed,"Vehicle")

2. Set(AuditTypePerformed,Gallery2.Selected.TypeOfAudit)

3. Set(AuditTypePerformed,Gallery3.Selected.InspectionType)

 

Now number 2 and 3 above are galleries linked to different collections.

 

I then add a 3rd gallery to the screen and set another datasource. In this gallery I use the Set(AuditTypePerformed... and suddenly all controls using this command error out with the message:

 

"The types of the specified global variables are incompatible with the types specified elsewhere"

 

Interesingly, even if I delete the new gallery from the app, the error does not clear and the global variable is in a state of "Error"

 

Error.PNG

 

I can confirm at all times I am dealing with strings with this variable. Any ideas?

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Anonymous
Not applicable

Hi @v-micsh-msft

 

I tried this previously with no luck, but after pondering your suggestiion I took a different tack. Basically anytime I used the Set() and the value came from a control, I wrapped it in a text() function, *before* I added the new gallery.

 

This time I am happy to report it worked. I suspect this issue is similar to something that happens when you clear and manipulate collections that have been previously initiualised in that you cannot change the schema. I checked at all times that the variable was reporting a type of "text" before making this change, so I guess this function really forces text.

 

Thankyou so much for the quick response... I still think there is a bug here somewhere but this at least makes it go away.

 

Paul

View solution in original post

2 REPLIES 2
v-micsh-msft
Community Support
Community Support

Hi @Anonymous,

 

I think the error here should be mostly related with the field type.

Please take a try to add Text() function with the other Gallery.selected.value within the Set function, see if this would make any difference.

For example:

 Set(AuditTypePerformed,
      text(Gallery2.Selected.TypeOfAudit)
     )

Regards,

Michael

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi @v-micsh-msft

 

I tried this previously with no luck, but after pondering your suggestiion I took a different tack. Basically anytime I used the Set() and the value came from a control, I wrapped it in a text() function, *before* I added the new gallery.

 

This time I am happy to report it worked. I suspect this issue is similar to something that happens when you clear and manipulate collections that have been previously initiualised in that you cannot change the schema. I checked at all times that the variable was reporting a type of "text" before making this change, so I guess this function really forces text.

 

Thankyou so much for the quick response... I still think there is a bug here somewhere but this at least makes it go away.

 

Paul

View solution in original post

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

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.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (2,799)