The below mentioned rows are my rows in SharePoint list.
Project Id | Closing Month | Comments |
1 | January | Hi |
1 | February | Hello |
I have a power app which patches the data to SharePoint. While patching the data, I need to check whether there is an existing entry for the same project id in that closing month and I need to update the record if it already exists and create a new record if that do not exist in that particular month. In the above example, if some one submits an entry for project id 1 and if still the closing month is February it needs to update the entry. This is the query I am using
If(IsEmpty(Filter('Source', Title = ClosingMonth && 'Project Id' = ProjectId)) ,Patch('Source',Defaults('Source'),{'Title':ClosingMonth,'Project Id':ProjectId,'Comments':Comments}, Patch('Source',First(Filter('Source', 'Project Id' = ProjectId && Title = ClosingMonth)),{'Comments':Comments}));
But this condition is not working. Appreciate any help.
Solved! Go to Solution.
@RandyHayes I have tried this in Text property and is returning true.
If(ClosingMonth="FY2021-P02"&&ProjectId=274," true","false")
Okay...still,
ProjectId = 274 & " / " & ClosingMonth = "FY2021-P02"
Should have returned "true / true". If there is something with that variable we need to get to the root of it as it is essential in the LookUp formula.
So, let's pull the ProjectId out of this as it sounds like that is working.
Set your Text property to :
ClosingMonth = "FY2021-P02"
This should show true.
ClosingMonth="FY2021-P02" is returning true and ProjectId=30052 is also returning true in the Label.
Hmmm...let's solve this mystery.
Test1:
Text property :
LookUp('Source', 'Closing Month'= ClosingMonth, ID)
Any Value?
Test2:
Text property:
LookUp('Source', 'Project Id' = ProjectId, ID)
Any Value?
Yes, that would be false as the closingmonth is not "FY2021-P02Hi"
@RandyHayes Hurray!!! We cracked it finally.
The catch is that as my button is residing outside the gallery where I have set the variables, In some other article I have read that we need to select Galleryname.selected.variable to compare with the SP List and it worked.
Thank you so much for providing the optimal solution. My App is working very fast now with your logic. Appreciate your help and appreciate your patience.
For the people who checks this thread for solution, please check this final post and refer to the main logic given by Randy.
Excellent!!! I knew we would get there. Even if we ended up writing a books-worth of messages 😉
Glad all is working now!
Hi @RandyHayes , the solution is working fine but it is working only for me. When Others are trying to submit the responses, the records are not getting added to the sharepoint list. Can you help me here in letting me know what I am missing?
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 |
---|---|
267 | |
225 | |
76 | |
38 | |
37 |
User | Count |
---|---|
338 | |
224 | |
121 | |
71 | |
57 |