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

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Carousel_PP_768x460_Wave2 (1).png

2022 Release Wave 2 Plan

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

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Top Solution Authors
Users online (3,340)