Hello All,
I tried looking for an existing article covering this specific scenario but couldn't find anything, so I finally decided to post my question here. I hope you can help me out, appreciate any assistance in advance.
Background:
I am creating an Onboarding platform using PowerApps and a SharePoint list as DataSource.
The SharePoint list contains:
Task [Multiple lines of text]
Instructions [Multiple lines of text]
Links [Multiple lines of text]
Done [Yes/No]
ProgressBar [Number]
ID ([Number] The one that SharePoint generates)
The PowerApps screen contains (picture included for reference):
A Gallery which contains a Checkbox, a Label and an Icon.
A Slider (Progress Bar).
A Button "Next".
The Gallery:
Items property is based on collectionOnboarding.
collectionOnboarding contains the same columns that are in the SharePoint list OnboardingTask plus a generated column named "IsChoosen", the formula is:
ClearCollect(collectionOnboarding, AddColumns(OnboardingTask, "IsChoosen",false));
The Checkbox:
OnCheck property contains the following formula:
UpdateContext({sliderValue: ProgressBar+12.5});
Patch(collectionOnboarding, ThisItem, {IsChoosen:true});
UnCheck property contains the following formula:
UpdateContext({sliderValue: ProgressBar-12.5});
Patch(collectionOnboarding, ThisItem, {IsChoosen:false});
The Label:
Its Text property is: ThisItem.Task
The Icon:
It's OnSelect property is: Set(varRecord, ThisItem);Navigate(OnboardingDetails, Cover)
(After I resolve the current issue, I will use this OnboardingDetails to Update the task content)
The Slider (Progress Bar)
It's Default property contains: sliderValue
It's Min property contains: 0
It's Max property contains: 100
It's DisplayMode is set to: View
The Button:
IT's OnSelect property contains:
ForAll(RenameColumns(Filter(collectionOnboarding, IsChoosen), "ID", "OID"), Patch(OnboardingTask, LookUp(OnboardingTask, ID=OID), {Done:IsChoosen}));
ClearCollect(collectionOnboarding, AddColumns(OnboardingTask, "IsChoosen", true));
It's DisplayMode property contains:
If(ProgressBar<100,DisplayMode.Disabled,DisplayMode.Edit);
The screen OnVisible property contains:
UpdateContext({sliderValue:0});
Scenario:
What I am trying to achieve with all this, is:
1. User will check each checkbox as it progress through the specific tasks. (This is working)
2. When user clicks each checkbox, the slider will grow until reaching it's maximum value. (This is working)
3. Only when the slider reaches its defined maximum value the button will be available to click, otherwise it will be disabled. (This is working)
4. When the user hits the Next button, It should patch the IsChoosen (checkbox value) "Yes" to the "Done" column of the SharePoint list. (This seems to be working, picture included)
6. When user comes back to this screen only by unchecking a checkbox it should update the status of the SharePoint list "Done" column to "No" and the progress bar should decrease accordingly. (This is not working, There are two points here:
a. The progress bar resets to 0 as per the OnVisible property states, I placed it like that, because I didn't find a different way to initialize it to 0, it was always showing at 50%.
b. When the user uncheck the checkbox it is not patching a "No" (false) to update the checkbox new status in the SharePoint list.
I hope I was clear enough and again, appreciate any assistance/help you can provide me to solve this situation.
Thanks and have a great day.