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

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:

example.PNG

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.

Need your help on this. 

 

Thank you!!

1 REPLY 1
Highlighted
Super User
Super User

Re: Look at second column on existing item in sharepoint

@shabila97 

I believe, at a glance, that you are on the track.

 

Let's disect your current formula:

If(Not(IsBlank(LookUp('DataSourceName', 'Date / Time' = 'ExpiredDate'))) && boolExistedPassport = "True", Navigate('Screen 2', ScreenTransition.None))

 

!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. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

Helpful resources

Announcements
Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (6,918)