web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Button function to dis...
Power Apps
Unanswered

Button function to disable and enable based on SP values

(0) ShareShare
ReportReport
Posted on by 125

Hello Everybody,

 

I'm trying to right some code that only lets the user fill in a form once each week.  Once the form is submitted to SP the button will be disabled until the next working week.

Each button is associated with a different business area, The function is looking up for a match on the list of the business area and the week number to match the current week, that that is true the button is disabled, if false the button is enabled.

I'm getting no errors in my code yet its not working, the button remains disabled even when the week numbers do not match.

 

Can anybody spot what I've missed here and help me understand how to correct it?

 

Thank you

 

 

If(
LookUp(
ScoreSheetCollection,
Title = "Business Area" && Value("WeekNumber") = ISOWeekNum(Today()),
true),
DisplayMode. Disabled,
DisplayMode. Edit
)

Categories:
I have the same question (0)
  • Verified answer
    iAm_ManCat Profile Picture
    18,228 Most Valuable Professional on at

    Hey @Chwilkinson 


    Your LookUp formula is the culprit here - you have the third parameter, the reduction formula, set as true, meaning that regardless of what returns, it returns true.

     

    You can modify your query to the following to get the desired result:

     

     

    If(
     //Here we check if the title returned by the lookup is not blank
     //If that is true then there must be a record there already, so disable
     !IsBlank(
     LookUp(
     ScoreSheetCollection,
     Title = "Business Area" && WeekNumber = ISOWeekNum(Today())
     ).Title
     ),
     DisplayMode. Disabled,
     DisplayMode. Edit
    )

     

     

     

    Cheers,

    Sancho

  • Chwilkinson Profile Picture
    125 on at

    Hello @iAm_ManCat (Sancho)

    Thanks for the quick response, I've just tried this code in the button display mode but its coming up with the following error - 

    The LookUp function has some invalid arguments

    Invalid number of arguments: received 3, expected 1

    Any suggestions?

    Thanks

    Chris

  • iAm_ManCat Profile Picture
    18,228 Most Valuable Professional on at

    Apologies, yes I left in the comma from your previous code, have amended my example code above 🙂

  • Chwilkinson Profile Picture
    125 on at

    Thanks @iAm_ManCat , (Sancho)

     

    Its almost working now.

    The only issue I'm getting now is that it says Value("Week Number") cannot be converted into a number. Types are incompatible.

    But my SP list column is a number column.  I'm not sure what's happening here.

    I've tried 

    Value("Week Number")

    "Week Number". Value

    "Week Number"

    "WeekNumber"  - As displayed in list settings

     

    Thank you

    Chris

  • iAm_ManCat Profile Picture
    18,228 Most Valuable Professional on at

    If it's a number column then we should be able to reference it directly as WeekNumber, have updated my code response 🙂

  • Chwilkinson Profile Picture
    125 on at

    Hi @iAm_ManCat ,(Sancho)

    Ha that's the only configuration I didn't try.  Thank you its working now.  

    Thank you for your help on this, I've banked some more knowledge!!

    Thanks,

    Chris

  • iAm_ManCat Profile Picture
    18,228 Most Valuable Professional on at

    Cheers, happy to help share the knowledge Chris, hope you have a good day!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard