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 am completely Blank.....
Yes all the data types are in the same way just as you mentioned. Yet When I combine them in the LookUp function, it is throwing the same error. Failed to fetch the items. Possible invalid string in the query.
I am verifying with the exact values present in the SP list. The ID is coming correctly in the Label when I use static values. The Values are coming correctly when I used &ProjectId. But I am not at all understanding why it is unable to fetch the value when I use
LookUp('Source', 'Project Id' = ProjectId && Closing Month= ClosingMonth, ID)
So, doing a full review of all of our messages...
I see that after you tried to use ProjectId in your formula, you got no return value (ID).
So, let's focus on that a bit.
You said that when you hard coded a value in for ProjectId that you got a result.
So, let's change the label text property to the following:
ProjectId = 1 & " / " & ClosingMonth = "January"
Replace the 1 and the "January" with values you know to be in your list.
The label SHOULD read "true / true"
Let's see what you get.
@RandyHayes Result is False. I am assuming the issue is with the closing month.
When I hover on ProjectId in this statement it says 274=274 but when I hover on closing month it says "FY2021-P02"=FY2021-P02.
FYI: My months are in the format of FY2021-P01, FY2021-P02 etc..
You mention false - there should have been two values "true / true" or "false / true" or "true / false" or "false / false"
Which one did you get?
I seemed to lean more toward the ProjectId being an issue because from before you said that is where it failed and you were not able to get an ID from the LookUp once you introduced that.
Also I am getting only false. But not false/false or true/false.
A warning message is being displayed stating that "Incompatible type. We can't evaluate your formula because the values being compared in the formula aren't the same type."
Okay...whack a mole here!
Let's change the label text property to the following: Text(ClosingMonth)
What do we get with that?
Okay...let's try this then in the text property:
ProjectId = 274 & " / " & Text(ClosingMonth) = "FY2021-P02"
Fingers crossed for "true / true"
@RandyHayes I am assuming when you mean by ProjectId and ClosingMonth, these are the variables that I have set in Power App.
If the above statement is correct, still no luck. I am getting false and an error stating Incompatible type and cant evaluate the formula which I have mentioned in previous post.
Okay, we need to get to the source of the issue with that variable then.
Let's go back to the Gallery, but first - go into the View Menu in the designer and click on Variables, then click on Global and then look for your CurrentMonth variable.
Tell me what it says under the variable for the variable type. Also what it shows in the right for the value in it.
Perhaps a screenshot of that would be helpful.