cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
HFG
Advocate II
Advocate II

Error when using an option set

Hi, 

I am trying to use an option set on a radio button and on my patch statement the formula checks which option has been selected so it knows what to update.

My radio button Items is set to Choices(ReservationDurationOptions) which is the option set and it is populating correctly on the control. However, when I look at the advanced formula bar it has the message "PowerApps encountered an internal error..."

My If statement is If(Rdo_Duration.Selected.Value = ReservationDurationOptions.'Full Day', Patch.... this is giving me the message "This formula has side effects and cannot be evaluated. 

Can anyone shed some light on where I'm going wrong and how to fix it?  

TIA

1 ACCEPTED SOLUTION

Accepted Solutions
v-siky-msft
Community Support
Community Support

Hi @HFG ,

 

Only one place I want to say that I usually use IsBlank() function with LookUp function, since IsEmpty() is basically used to test whether table contains any record. If use IsEmpty() function to test a Record, the results may be wrong in some case.

 

Sik

 

View solution in original post

12 REPLIES 12
v-siky-msft
Community Support
Community Support

Hi @HFG ,

 

The formula looks great, It's more like a PowerApps or PowerApps studio issue. The following two methods are the available solutions that are currently collected from users, please have a try.

1. change another browser

2. save the app to computer, then upload it again 

 

Sik

Hi @v-siky-msft , 

 

Thanks for your reply. 

I have tried in another browser and have the same messages. I probably should have mentioned that this is in the new PowerApps/CDS in Teams (Project Oakdale). Can I save an reupload somehow? 

Thanks

v-siky-msft
Community Support
Community Support

Hi @HFG ,

That's not supported for Teams Oakdale. Could you please try with this code to see if it helps? Change the radio's selection to text type using Text() function. 

 If(Text(Rdo_Duration.Selected.Value)="Full Day", Patch....

Hope this helps.

Sik

RishabBehl31
Resolver I
Resolver I

Hey @HFG,

 

I think this is due to some issue with formula. According to me your formula looks good too. But as you encountering this error try going with:

 

If(Rdo_Duration.Selected.Value = "Full Day")

 

Thanks for taking my input. If this works for you. A thumbs up is highly appreciated!

 

Warmly:)

 

Hi @HFG ,

 

Have your issue been fixed?

Feel free to post back if there are any questions.

Sik

Hi @v-siky-msft , 

 

Sorry for the delay, I was away last week. When you say that it's not supported in Project Oakdale do you meane CDS Option Sets? Should I remove the option set from my table? 

 

Thanks

Hi @RishabBehl31 , 

 

Thanks for your reply. As I am working with a CDS option set I believe need to reference to name of the option set too in the formula and not simply the selected item. This video from Shane Young is useful when working with option sets: https://www.youtube.com/watch?v=1L633HIvNGE

 Kind regards, 

 

HFG

v-siky-msft
Community Support
Community Support

Hi @HFG 

 

When I said 'Not Supported', it mean saving and reloading the app in Team project Oakdale is not supported.

 

Have your tried my suggestion above that convert the option set to text by Text() function?

Sik

Hi @v-siky-msft , 

 

Sorry I misunderstood. Unfortunately Text does not work as it says that it cannot evaluate as the two values are different. However, I did somthing I should have done already and I tested removing the option set part of my If statement and leaving only the second part and the Patch didn't work. I then tried with only my option set part and it does so the problem is not there. Here is my formula: 

 

If(Rdo_Journée.Selected.Value = ReservationDurationOptions.'Journée complète'
    && IsEmpty(
                LookUp(Reservations
                      ,DAT_Reservation = varDay
                     && LOOK_Poste.TXT_Lib = "DTR-Doc-08"
               )
           )
,
Patch(...
)

Any ideas? The LOOK_Poste is a look up column so I have dotted into it. When I highlight the IsEmpty part of the formula it evaluates to true so I really don't know why it's not working. 

Thanks

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 is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Did you miss the call? Check out the recording here!

Top Kudoed Authors
Users online (22,320)