I am not a programmer, so bare with me...
I have an app based on the Employee Engagement Survey that I have modified to fit my needs except for one step.
For each new 'survey' that is completed and posted to the data file, it is not appended, but over-writes the existing data. How do i modify the program to append to the next available row in exel to keep a running log?
Solved! Go to Solution.
Hi @iPhoneBeta,
This Survery won't create a new record for the same user in the Excel file.
Actually, it will first check to see if there is a record for the user logged in, if yes, this App will update the existing record.
The structure of the Next button under the Question 5 screen is as below:
If(!IsBlank(LookUp(Responses,Username=User().FullName,Responses)),
UpdateIf(Responses,Username=User().FullName,{Record}), UpdateContext({NewSurvey: Patch(Responses,Defaults(Responses), {Record})}))
So if here you would like to just creating new record for the same user, then you can remove the If condition check and only leave the UpdateContext() part.
For example:
UpdateContext({NewSurvey:
Patch(Responses,
Defaults(Responses),
{ResponseId:Text(CountRows(Responses)+1),
Answer1:Radio1.Selected.OptionText,
Answer2:Replace(Concat(Listcollect,OptionText & ", "),Len(Concat(Listcollect,OptionText & ", "))-1,1," "),
Answer3:Text(Slider1.Value),
Answer4:If(Radio1_1.Selected.OptionText="No","No," & TextInput1.Text,Radio1_1.Selected.OptionText),
Answer5:TextInput1_1.Text,Username:User().FullName})});
Navigate(Finish_Screen,ScreenTransition.Fade)
Copy and paste the code above should be OK to have the App only creating new records, instead of Updating the existing record.
Regards,
Michael
V-Misch-
Thank you for breaking out the solution. I had to remove one extra close parenthesis, but all else worked great.
Final code:
UpdateContext({NewSurvey:Patch(Responses,Defaults(Responses), {ResponseId:Text(CountRows(Responses)+1), Answer1:Radio1.Selected.OptionText,Answer2:Replace(Concat(Listcollect,OptionText & ", "),Len(Concat(Listcollect,OptionText & ", "))-1,1," "),Answer3:Text(Slider1.Value), Answer4:If(Radio1_1.Selected.OptionText="No","No," & TextInput1.Text,Radio1_1.Selected.OptionText),Answer5:TextInput1_1.Text,Username:User().FullName})});Navigate(Finish_Screen,ScreenTransition.Fade)
Thanks Rebetcha for the link. To answer you question- No, I didn't modify that formula. Just to be sure, I tested the original unaldulatered Engagement Survey, and it also does not append the new data.
Hi @iPhoneBeta,
This Survery won't create a new record for the same user in the Excel file.
Actually, it will first check to see if there is a record for the user logged in, if yes, this App will update the existing record.
The structure of the Next button under the Question 5 screen is as below:
If(!IsBlank(LookUp(Responses,Username=User().FullName,Responses)),
UpdateIf(Responses,Username=User().FullName,{Record}), UpdateContext({NewSurvey: Patch(Responses,Defaults(Responses), {Record})}))
So if here you would like to just creating new record for the same user, then you can remove the If condition check and only leave the UpdateContext() part.
For example:
UpdateContext({NewSurvey:
Patch(Responses,
Defaults(Responses),
{ResponseId:Text(CountRows(Responses)+1),
Answer1:Radio1.Selected.OptionText,
Answer2:Replace(Concat(Listcollect,OptionText & ", "),Len(Concat(Listcollect,OptionText & ", "))-1,1," "),
Answer3:Text(Slider1.Value),
Answer4:If(Radio1_1.Selected.OptionText="No","No," & TextInput1.Text,Radio1_1.Selected.OptionText),
Answer5:TextInput1_1.Text,Username:User().FullName})});
Navigate(Finish_Screen,ScreenTransition.Fade)
Copy and paste the code above should be OK to have the App only creating new records, instead of Updating the existing record.
Regards,
Michael
V-Misch-
Thank you for breaking out the solution. I had to remove one extra close parenthesis, but all else worked great.
Final code:
UpdateContext({NewSurvey:Patch(Responses,Defaults(Responses), {ResponseId:Text(CountRows(Responses)+1), Answer1:Radio1.Selected.OptionText,Answer2:Replace(Concat(Listcollect,OptionText & ", "),Len(Concat(Listcollect,OptionText & ", "))-1,1," "),Answer3:Text(Slider1.Value), Answer4:If(Radio1_1.Selected.OptionText="No","No," & TextInput1.Text,Radio1_1.Selected.OptionText),Answer5:TextInput1_1.Text,Username:User().FullName})});Navigate(Finish_Screen,ScreenTransition.Fade)
Check out new user group experience and if you are a leader please create your group
Did you miss the call?? Check out the Power Apps Community Call here!
See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.
User | Count |
---|---|
257 | |
247 | |
82 | |
36 | |
30 |
User | Count |
---|---|
299 | |
267 | |
117 | |
66 | |
45 |