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 / Saving score from powe...
Power Apps
Unanswered

Saving score from powerapps to sharepoint

(0) ShareShare
ReportReport
Posted on by 64

Hi,

 

I have an app which "OnStart" collects information of the user and saves it to SP list, then I want to save and add score per user when checkbox or radio button is selected.

There are about 30 buttons which corelates to different score values, those I wish to add per user progress in the SP.

I have tried different approaches but I am unable to Patch the result to dedicated SP column called "Score". The other thing is that it needs to add up the value with each selection, ex. +10 +50 and etc.

 

For now I have come up with this logic, but it doesn't write to the SP and I am lost why:

 

 

ClearCollect(
 colUserRecord,
 globalUserRecord
);
If(
 Checkbox2.Value = true,
 Set(Score,100
 ),
 Set(Score,0
 )
);
UpdateIf(
 colUserRecord,
 true,
 {Score: Score}
);
Set(
 globalUserRecord,
 First(colUserRecord)
);
Patch(
 'Employee progress',
 LookUp(
 'Employee progress',
 UserEmail = varUserEmail
 ),
 globalUserRecord
);

 

 

Any help will be much appreciated. 

Categories:
I have the same question (0)
  • Verified answer
    WarrenBelz Profile Picture
    152,859 Most Valuable Professional on at

    Hi @YDdecs ,

    I am not sure exactly what you are doing with the collections, but if you want to add the score to the existing List item belonging to the user, try this

    With(
     {
     wScore: 
     If(
     Checkbox2.Value,
     100,
     0,
     ),
     wItem:
     LookUp(
     'Employee progress',
     UserEmail = varUserEmail
     )
     },
     Patch(
     'Employee progress',
     {ID: wItem.ID},
     {Score: wItem.Score + wScore}
     )
    )

     

    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.

    Visit my blog Practical Power Apps

  • YDdecs Profile Picture
    64 on at

    @WarrenBelz ,

    this worked like a charm, I guess the collection was giving me problem, as my logic was first to make it in collection and then patch it to SP, but this is great.

     

    Now I saw a small issue, basically every time the checkbox is selected it will add up the Score value.

    What could be the best approach to keep the progress per user and not allow the check box to be selected second time?

     

    Thanks a million!

  • YDdecs Profile Picture
    64 on at

    Actually I created the below now in order to make it disabled ones it is selected:

    If(Checkbox2.Value,DisplayMode.Disabled,DisplayMode.Edit)

    But now the question is, how do i keep it disabled every time a given user opens the app and this is per user of course? Basically I need to save it and continue later from last of some kind.

  • WarrenBelz Profile Picture
    152,859 Most Valuable Professional on at

    Hi @YDdecs ,

    Set a Variable when the code is run - it will remain set during the session and you can use this to disable the control from that point on.

  • YDdecs Profile Picture
    64 on at

    @WarrenBelz 

    Sorry didn't get that, could you give me some hint or example?

    And what I need to accomplish is that when the apps is closed and later new session is started by the same user to have the already checked boxes to stay greyed out.

    Thanks!

  • WarrenBelz Profile Picture
    152,859 Most Valuable Professional on at

    Hi @YDdecs ,

    That is an entirely different question  - the DisplayMode of your submit Button

    With(
     {
     wList:
     Sort(
     'Employee progress',
     ID,
     Descending
     )
     },
     If(
     IsBlank(
     LookUp(
     'Employee progress',
     'Created By'.EMail = User().Email &&
     IsToday(Created)
     ).Score
     ),
     DisplayMode.Edit,
     DisplayMode.Disabled
     )
    )
    

     

    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.

    Visit my blog Practical Power Apps

  • YDdecs Profile Picture
    64 on at

    What you suggested seems very logical, and there is no error on the code, but in my solution it doesn't make any change.

    For the purpose I created additional button and placed the code in DisplayMode , but it doesn't save the change, when new session is opened by the same user the check boxes are again "unchecked".

     

  • WarrenBelz Profile Picture
    152,859 Most Valuable Professional on at

    @YDdecs ,

    That code was for the DisplayMode of the submit button, not the state of the check boxes and simply looks to see if the users has already created a record on the day, disabling the button if they have.

  • YDdecs Profile Picture
    64 on at

    Hi @WarrenBelz ,

     

    I understood the logic of the code and it is placed in submit button, but it neither disables the checkboxes or the button itself. 

    Code is correct with no errors and I even wrote it myself to be sure that powerapps recognizes the commands, but still no action is happening.

     

    I am still researching for any other possibilities to save progress per user and when new session is initiated not to be able to click on previous checkboxes.

     

    The basic architecture of my app is:

    I have 6 different screens , where on each there are pictures and when it's clicked user is being redirected to a link.

    Each picture has score and there where the checkboxes come in handy, connecting to SP list and adding the scores per user.

    Everything is working like a charm, only left is to try and eliminate the human error of same checkbox being marked again when new session is started.

     

    And again thanks for your help and guidance, really appreciated.

     

  • Verified answer
    WarrenBelz Profile Picture
    152,859 Most Valuable Professional on at

    @YDdecs ,

    If these are updated records, try Modified instead of Created

     

    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.

    Visit my blog Practical Power Apps

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 759 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 310 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 228

Last 30 days Overall leaderboard