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

Check in and check out app importing and feeding responses back in to the same sharepoint list

Hi everyone,

 

I am new to sharepoint and powerapps and I'm in the process of creating the above app. I have managed to create a check in app which pulls up a sharepoint list and with the submitform function saves the data back to the list. Participants enter information in to a conditional powerapps form and that populates the fields in the sharepoint list. It also collects their expectations for the session.

 

I would also like to add a check out component where they answer post sessions questions. They would have to have checked in to check out and be able to answer questions without having to re enter all their details from the check in. I would like both the check out and check in components to be recorded as a single record on the sharepoint list (1 row).. 

 

Would this be possible? My apologies in advance if the scenario is unclear and I'm happy to answer further questions about it.

 

Thanks in advance!

17 REPLIES 17

Hi @snan004 ,

Q1:
'Name' is a fieldname in my example, not a label name.

The syntax of Patch is:

Patch(datasource,Defaults(datasource),{fieldname:value,...})

Patch(datasource,item,{fieldname:value,...})

I suggest you learn more about this function:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-patch

 

Q2:

Let me explain my app.

In welcome screen, after you enter user name in the textinput, you could click "check in" button or "check out" button.

If you click "check in" button, you will create a new record with the name that you entered and navigate to the checkinscreen.

If you click "check out" button, if this user has checked in, you will navigate to checkout screen.

If this user has not checked in, you will get a warning.

 

Q3:

I need you to check whether your list has required field.

You could check this in your list settings.

Like this:

47.PNG

 

If you have required field in your list, when you create record without this required field, you will not update successfully.

I suggest you make all other fields not required, make 'What is your name?' field reuqired. Because this field should have value.

 

Q4:

On your side, you could use these formulas.

You need to change all my test values to yours.

1)

check-in button's OnSelect:

Patch(Participants,Deafults(Participants),{'What is your name?':TextInput2.Text});Navigates(CheckInScreen)

 check-out button's OnSelect:

If(IsEmpty(LookUp(Participants,'What is your name?'=TextInput2.Text),
Notify("you haven't checked in"),
Navigate(CheckOutScreen)
)

 2)in checkinscreen

The edit form's Item:

LookUp(Participants,'What is your name?'=TextInput2.Text)

Choose the fields that you want user to answer when he check in.

3)in checkoutscreen

The edit form's Item:

 

LookUp(Participants,'What is your name?'=TextInput2.Text)

 

Choose the fields that you want user to answer when he check out.

 

Hope this time you understand more.

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks so much @v-yutliu-msft 

 

I spent a lot of time last night and just managed to get it to work but it only seems to work properly every time I restart the app (one single record for both check in and check out in one row). Each time I have to reenter the onselect and items formulas, refresh and it seems to work. From the second record i enter I still get 3 different records (3 rows)on the sharepoint list! I have entered all the formulas as you suggested and with my data source and field values and made sure all the syntax is correct... it doesn't seem to want to work for me! I have attached a screenshot (Capture2 - the first row combined the text input and the check in form submission but not the following entries..)

 

Other issues:

 

1.

The error message - even without a record created i.e. no check in, I am able to enter a new name, click check out and it goes directly to the check out field and I am able to populate and submit. If I leave the field blank and and check out it gives an empty form (I have attached the sshots). No error messages pop up (the Notify("you haven't checked in") error)

 

2.

Required fields - like you suggested I would like to make the text box field compulsory. However when I do, the link between the text input in the welcome screen and the check in form is lost.

 

Thanks so much again!

Hi @snan004 ,

That's really strange. My formulas work good on my side.

Please check these points:

1)in sharepoint list, only make 'What is your name?' field required

2)in welcome screen

TextInput2 is your textinput control name

check-in button's OnSelect:

Set(name,TextInput2.Text);
Patch(Participants,Deafults(Participants),{'What is your name?':name});
Navigate(CheckInScreen)

 check-out button's OnSelect:

Set(name,TextInput2.Text);
If(IsEmpty(LookUp(Participants,'What is your name?'=name)),
   Notify("you haven't checked in"),
   Navigate(CheckOutScreen)
)

 3)in checkinscreen

set the edit form's datasource : Participants

set the edit form's DefaultMode: FormMode.Edit

set the edit form's Item:

LookUp(Participants,'What is your name?'=name)

Choose the fields that you want user to answer when he check in.

 4)in checkoutscreen

set the edit form's datasource : Participants

set the edit form's DefaultMode: FormMode.Edit

set the edit form's Item:

 

LookUp(Participants,'What is your name?'=name)

 

Choose the fields that you want user to answer when he check out.

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-yutliu-msft thanks again. I seemed to have got your original method going (I think it was an issue with my sharepoint list..) However I still have a few kinks and would like to add a few additional measures if you can help me!

 

A. I would like to add some error messages.

 

Welcome Screen:

1. IF the nameinput field is empty --> click check in-->Error='please enter your name to continue' (Stays on welcome screen and error appears there)

2. IF the nameinput field is empty --> click check out-->Error='please enter your name to continue' (Stays on welcome screen and error appears there)

3. IF name entered doesn't match already entered names (not checked in before) --> Error='please check in to continue' (Stays on welcome screen and error appears there) - this appears to be similar to the Ifempty statement you gave in the first instance. This is what I have at present and it doesn't give an error as I mentioned before. It navigates to the checkout screen but doesn't display the form. 

CheckOut button onselect welcome page: If(IsEmpty(LookUp(Participants,ParticipantName=NameInput.Text)), Notify("Make sure you have checked in before you check out"), Navigate(Checkoutscreen))

CheckOut button onselect welcome page: Patch(Participants,Defaults(Participants),{'ParticipantName':NameInput.Text});Navigate(Checkinscreen) 

 

I want these 3 errors to make the user not have to navigate back to the welcome screen or reset the form.

 

B. A user editing a form (re-entering CheckIN and CheckOut screens and resubmitting)

 

At present when a user re-enters to check in they are able to successfully update their record. However, a new duplicate of the same record is created on the sharepoint list with just the name field. 1 updated full record and a second record just with the name. How do I resolve this? It doesn't seem to appear for the checkout resubmission - i.e. original record is updated and no duplicate row created.

 

My formula for Checkin submission button: SubmitForm(Form1) And Navigate([@Welcome]) And Reset([@NameInput]) - I added the reset fx to empty the nameinput field when it goes back to the welcome screen

My formula for Checkout submission button: SubmitForm(Form2) And Navigate([@Welcome]) And Reset([@NameInput])

 

C. Previously filled columns still remain with original values

 

A bit of context on my app - it's for school staff to check in and check out from a workshop. Depending on their role they answer different questions in both the checkin and checkoutscreens.

 

For example if someone checks in as a teacher and then realises they made a mistake after submission and want to check in as a school leader instead they would go back in to the form to edit. However when I test this I notice that the responses to conditional questions they answered as a teacher in the previous submission still remain even after they have seen and responded to different questions as a school leader. Is there a way to clear those fields if they change their role? I hope my explanation is clear!

 

Thanks so much!

Hi @snan004 ,

Q1:welcome screen:

check-in button's OnSelect:

Set(name,TextInput2.Text);
If(IsBlank(name),
   Notify("please enter your name to continue"),
   Patch(Participants,Deafults(Participants),{'What is your name?':name});Navigates(CheckInScreen)
  )

 check-out button's OnSelect:

Set(name,TextInput2.Text);
If(IsBlank(name),
   Notify("please enter your name to continue"),
   If(IsEmpty(LookUp(Participants,'What is your name?'=name)),
      Notify("please check in to continue"),
      Navigate(CheckOutScreen)
      )
  )

Please refer doc about Notify function:https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-showerror

Q2:

Do you want to remove the record of same username but different role?

Could you tell me how do you get a user's role? I assume that is a field in the checkinform/checkoutform that user needs to fill in.

Then you could use this data to justify whether he has other records with different roles.

Remove those records after submit.

For example:

set the submit button1's OnSelect:

Set(role,roletextinput.Text);
SubmitForm(Form1);
If(
CountRows(Distinct(Filter(Participants,'What is your name?'=name),role))>1,
RemoveIf(Participants,'What is your name?'=name,Not(Role=role)
)

 set the submit button2's OnSelect:

Set(role,roletextinput.Text);
SubmitForm(Form2);
If(
CountRows(Distinct(Filter(Participants,'What is your name?'=name),role))>1,
RemoveIf(Participants,'What is your name?'=name,Not(Role=role)
)

Please refer the doc about RemoveIf function:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-remove-removeif

 

 

Best regards,

 

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks again @v-yutliu-msft ! I just want to clarify a couple of points

 

Q1:welcome screen:

check-in button's OnSelect:

Set(name,TextInput2.Text);
If(IsBlank(name),
   Notify("please enter your name to continue"),
   Patch(Participants,Deafults(Participants),{'What is your name?':name});Navigates(CheckInScreen)
  )

 check-out button's OnSelect:

Set(name,TextInput2.Text);
If(IsBlank(name),
   Notify("please enter your name to continue"),
   If(IsEmpty(LookUp(Participants,'What is your name?'=name)),
      Notify("please check in to continue"),
      Navigate(CheckOutScreen)
      )
  )

Please refer doc about Notify function:https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-showerror

 

What is the 'name' in  Set(name,..)? Is that referring to a particular field on my sharepoint list? it's not the function NAME as I can't select it when I type it in. Or is it a case of labeling that field as a name and then using that as a reference elsewhere? Sorry if that is something straightforward and simple that I'm not getting! 

 

 

Q2:

Do you want to remove the record of same username but different role?

Could you tell me how do you get a user's role? I assume that is a field in the checkinform/checkoutform that user needs to fill in.

Then you could use this data to justify whether he has other records with different roles.

 

It's a lookup column from the sharepoint list - the question is 'You are a:' and they have to select from a few options. Depending on the option they select questions will be visible - I have set the VISIBLE function for those fields with an IF statement. Here's an example: If(YouAreA.Selected.Value = "School Leader", true, false) Or If(YouAreA.Selected.Value = "Teacher", true, false) Or If(YouAreA.Selected.Value = "Student", true, false)

 

So if they select a different role when they edit the checkin for whatever reason I want those earlier responses attached to the previous role they selected to be cleared from the sharepoint list...

 

 

Remove those records after submit.

For example:

set the submit button1's OnSelect:

Set(role,roletextinput.Text);
SubmitForm(Form1);
If(
CountRows(Distinct(Filter(Participants,'What is your name?'=name),role))>1,
RemoveIf(Participants,'What is your name?'=name,Not(Role=role)
)

 set the submit button2's OnSelect:

Set(role,roletextinput.Text);
SubmitForm(Form2);
If(
CountRows(Distinct(Filter(Participants,'What is your name?'=name),role))>1,
RemoveIf(Participants,'What is your name?'=name,Not(Role=role)
)

Please refer the doc about RemoveIf function:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-remove-removeif

 

Hi @snan004 ,

Q1

I use text in textinput to set a variable. Name is variable.

Please refer set function :

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-set

Q2

Then you could filter based on this 'You are a:' field, like this:

Set(role, 'You are a:' textinput.Text);
SubmitForm(Form1);
If(
CountRows(Distinct(Filter(Participants,'What is your name?'=name), 'You are a:' ))>1,
RemoveIf(Participants,'What is your name?'=name,Not( 'You are a:' =role)
)

//role is another variable that I set, use text in yourarea textinput. Please replace with your textinput name.

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Hi @v-yutliu-msft 

 

I am still having problems with the most important error message I need 😞

 

Welcome Screen:

1. IF the nameinput field is empty --> click check in-->Error='please enter your name to continue' (Stays on welcome screen and error appears there)

This works

2. IF the nameinput field is empty --> click check out-->Error='please enter your name to continue' (Stays on welcome screen and error appears there)

This works

 

3. IF name entered doesn't match already entered names (not checked in before) --> Error='please check in to continue' (Stays on welcome screen and error appears there) - this appears to be similar to the Ifempty statement you gave in the first instance. This is what I have at present and it doesn't give an error as I mentioned before. It navigates to the checkout screen but doesn't display the form. 

 

This is the one I am having problems with. This is the formula I have at present:

 

Set(name,NameInput.Text);
If(IsBlank(name),
Notify("please enter your name to continue"),
If(IsEmpty(LookUp(Participants,'What is your name?'=name)),
Notify("please check in to continue"),
Navigate(Form2)))

 

The blank error component works fine. It's the lookup section that is giving me trouble. I have tried using the field name (ParticipantName in my sharepoint list) as well as the data card name (I was able to select the What is your name? component from the drop down when making the formula) but neither of them work. Is there a difference in using the two? I noticed that when we used the Patch function we used the field name (ParticipantName) but now we are using the column name (What is your name?)

 

When I click checkout with a name that's not on the list it still navigates to the check out screen.

 

Set(name,NameInput.Text);
If(IsBlank(name),
Notify("please enter your name to continue"),
If(IsEmpty(LookUp(Participants,'ParticipantName'=name)),
Notify("please check in to continue"),
Navigate(Form2)))

 

Any help would be great. I have checked and rechecked the formulas so many times and I'm still stuck!

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (1,567)