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

Need to disable button if User has value in column

Hi All,

 

I have a formula that says 

 

If(IsBlank(ThisItem.Start), DisplayMode.Disabled,DisplayMode.Edit)

 

How can I make this user specific. ie if this item is created by a particular user and in this item if the start column has value and rest items created by the same person does not have a value then the button must be disabled.

1 ACCEPTED SOLUTION

Accepted Solutions

@aswin12345 ,

This is a logic rather than a coding exercise and I built the model to show you the variety of variables that you can set/reset to achieve the result you want. It seems that you need to set some values when a new item is added or the gallery refreshed. You tagged me for assistance and I am trying to provide that, but ultimately I cannot test exactly what you want.

Have you tried setting the variables (particularly vPlay) to different values with new items and refreshing to see what result is achieved? 

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

13 REPLIES 13
Super User III
Super User III

Can you explain further. Is the Button inside a Gallery?

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Impactful Individual
Impactful Individual

If(Thisitem.Created.Mail = User().Mail && IsBlank(ThisItem.Start), DisplayMode.Disabled,DisplayMode.Edit)

Community Support
Community Support

Hi@aswin12345,

Based on the issue that you mentioned, do you want to disable the edit function of the item if a user has already entried in the start column?

Could you please share more about your scenario, what is this button for?

I agree the most with @cds , you should validate the user first by comparing 'Created By'.Eamil with User().Email and then check the Start column value.

Please modify your formula, set the OnSelect property of the Button as below.

 

If(
    ThisItem.'Created By'.Email = User().Email && !IsBlank(ThisItem.Title),
    DisplayModeDisabled,
    DisplayModeEdit
)

 

Best Regards,

Qi

Hi @v-qiaqi-msft  No I need to disable the edit function of all other items except this one and when I click on pause I need to activate all other

Hi @eka24 @v-qiaqi-msft @cds 

 

Yes the buttons are inside the gallery. Please find the image below. In the below buttons when I click on Play button Play will be hidden and pause and stop will be activated in one item but at the same time I want the play button in other items to get disabled. and when i click on pause button I want play button to be activated. I achieved this by using the visibility of the yellow highlight. But when I refresh the disability functionality goes away.   

Capture.JPG

@WarrenBelz @mdevaney 

@aswin12345 ,

Thanks for the tag, I will throw my 20c worth in. I have built a model as below - you might have to fine-tune some of this, but you will get the idea

PlayButtons.gif

Here are the settings - Firstly for a reset

UpdateContext({vPlay:false})

Now the DisplayMode

Pause Button
If(
    ThisItem.IsSelected && !vPlay && !vPause,
    Disabled,
    Edit
)

Play Button
If(
     ThisItem.IsSelected && vPause,
    Disabled,
    Edit
)

Stop Button
If(
    ThisItem.IsSelected && !vPlay,
    Disabled,
    Edit
)

OnSelect

Pause
UpdateContext(
    {
        vPause: !vPause,
        vPlay: !vPlay,
        vStop: false
    }
)

Play
UpdateContext(
    {
        vPause: false,
        vPlay: true,
        vStop:false
    }
)

Stop
UpdateContext(
    {
        vPause: false,
        vPlay: false,
        vStop:true
    }
)

Finally the Fill

Pause
If(
    ThisItem.IsSelected,
    If(
        vPause,
        DarkRed,
        DarkBlue
    ),
    Blue
)

Play
If(
    ThisItem.IsSelected,
    If(
        vPlay,
        DarkRed,
        DarkBlue
    ),
    Blue
)

Stop
If(
    ThisItem.IsSelected,
    If(
        vStop,
        DarkRed,
        DarkBlue
    ),
    Blue
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Hi @WarrenBelz 

 

I am really humbled and appreciate the time you have taken for providing with the formulas. But the thing is I want a different solution ie if we take your scenario as an example when we click play on one row all the other play button in the different rows must be disabled and when I click on the pause button of in the row all the play button should become active

Hi @aswin12345 ,

If you get rid of the ThisItem.IsSelected, I think it will do the job as all this did was isolate the code to the selected item.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Hi @WarrenBelz 

 

Could you please guide me on two more things firstly after adding this formula will this change even after refresh? because i have achieved this in a different way where if i click on play rest play button will be disabled and if i click on pause or stop all the play button will be activated. But when I add an item or refresh the page all the button will be enabled.

2. where should insert the below formula

 

UpdateContext({vPlay:false})

 

Helpful resources

Announcements
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

Top Solution Authors
Top Kudoed Authors
Users online (63,125)