Look at second column on existing item in sharepoint
I created powerapps form and published it to sharepoint online.
In sharepoint online i have column for Identical Card / Passport number and Date (registered date).
Refer to the picture below:
Janice submit her info for the first time on 22/02/2019. So her expired date will be 7 days after that, which is 1/03/2019.
On a button in powerapps, on OnSelect property. I have set: 1- (to set expiry date - i've completed this successfully) Set(ExpiredDate, Text(DateAdd(Now(), 7), "dd/mm/yyyy hh:mm AM/PM"));
2- (to check either the entered Passport Number is already exists or a new one - i've completed this successfully) Set(boolExistedPassport, Not(IsBlank(LookUp('DataSourceName', 'Identical Card/Passport Number' = DataCardValue2.Text))));
3-(to look expired date for existed Passport Number - need yout help for this) If(Not(IsBlank(LookUp('DataSourceName', 'Date / Time' = 'ExpiredDate'))) && boolExistedPassport = "True", Navigate('Screen 2', ScreenTransition.None));
Here, if Janice submit for the second time, system will check Janice's last submitted form is already expired or not.
!IsBlank(LookUp('DataSourceName', 'Date / Time' = 'ExpiredDate')) The first part is fine (I did shorten it with the ! in this case - your choice if you want to use ! or NOT, they are both the same). However, what I'm not getting clear on is this - you mention in your post that you Set(ExpiredDate, ...) So, you're setting a variable...how is that getting back to your ExpiredDate field in your datasource? Are you Patching, Submitting or Updating somewhere? If NOT, then this Lookup will never return a result. You WILL need to update your datasource with the ExpiredDate before this will work.
&& boolExistedPassport = "True" This is probably working, but NOT a good practice. Here you are comparing a boolean (true/false) field to a string. PowerApps will convert for youbut you can really just say && boolExistedPassport
Check on some of those items and see if that helps you get to the next step.
Beyond that...I would say, you might want to reconsider that logic path you are taking to reach your conclusion of "Does Janice have an expired, non-expired, or no passport?"
One could say that the following is true (this is not verbatim formula, just as example):
Does Janie have a passport?
IsBlank(Lookup('DataSourceName', 'Identical Card/Passport Number' = DataCardValue2.Text)) = true, then no passport
!IsBlank(Lookup('DataSourceName', 'Identical Card/Passport Number' = DataCardValue2.Text)) = true, then there is a passport
Does Janice have an expired or non-expired passport?-
Max(Filter('DataSourceName', 'Identical Card/Passport Number' = DataCardValue2.Text), 'Date / Time') < Today() - True, then yes, it is expired.
!(Max(Filter('DataSourceName', 'Identical Card/Passport Number' = DataCardValue2.Text), 'Date / Time') < Today()) - True, then yes, it is not expired.
This should give you some fuel for thought.
Hope it helps.
_____________________________________________________________________________________ Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did. Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes Really want to show your appreciation? Buy Me A Cup Of Coffee!