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

Having issues patching a Blank() value to a choice and people column

Hi all,

 

I am trying to patch a blank value to a choice column (called Unit) if another choice column is a certain value when saving (the field is called Section, with a specific value "AA" that causes a reset). Here is my Patch code onSelect for my Save Button:

 

Patch(Log1, varRecord, {
Section: drpSection_Update.Selected,
Unit: If(drpSection_Update.Selected.Value = "AA", Blank(), drpUnit_Update.Selected),

...}) 

 

I have the correct Experimental feature turned on after following this video from Reza. But after patching, the Unit section does not reset and stays the same. Does anyone have any advice? Thanks in advance.

3 REPLIES 3
FMontesRNX1
Resolver II
Resolver II

So you're working with already created registries? Or this is always as new entries?
If you're working with new registries (New Form), you can control some properties based on the value. Here some examples (you'll need to test on your app because i don't have now where to validate):
Option 1.
On Unit DataCardValue:
Default: ""
DisplayMode: If(drpSection_Update.Selected.Value = "AA", Disabled, Edit)
By this way the user will not able to select values when selecting "AA" on 'Section'.

 

Option 2.
On Unit DataCardValue:
Default: ""
On Unit DataCard:
Visible: If(drpSection_Update.Selected.Value = "AA", false, true)

With this the question will not be visible then selecting "AA".

 

Option 3.
On Unit DataCardValue:
Items:  If(drpSection_Update.Selected.Value = "AA", [], ["Item1","Item2"])

Otherwise, if you're working with an already created registry, and you're editing, is important to know your data source, (Ex. If were a SP list, you can set the value as a rule.).
But you can try:

On Unit DataCardValue:
Default: If(drpSection_Update.Selected.Value = "AA", Blank(), drpUnit_Update.Selected)
This will require a SubmitForm button to save changes.

 

Hope it helps, otherwise please tell us any important additional information.

Thanks for your response. This is with already existing records in a SharePoint list, and I need to use the Patch function. When I try your suggestion on the Unit DataCardValue I get the following: 

marclotorto1_0-1649792251033.png

 

This happens in default for the data card as well as the default for the dropdown picker. Any other ideas? I'm pretty stuck. I need to reset a dropdown based on another dropdown throughout my app, and this is giving me a hard time. Thanks for your help.

FMontesRNX1
Resolver II
Resolver II

OK the challenge will be to avoid circular reference, because you're using the record info to change it.
You should try the following:
-Create on Power Automate a Cloud automated flow, with the trigger 'When an item is updated'
-Create step to get recently updated item

-Create condition to validate Section value equals "AA"

-If yes, Update Item, edit on Unit to <empty>, let the other values as same as original registry.

Unfortunately will not be automatically changed from the app, but will be visible when the flow finishes successfully, you can control the Unit DataCard visibility according to the value.
-Set 'No' Condition empty, or with a 'Terminate' step.

 

That's my idea for now, I'll let you know for any new way.

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (5,411)