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

Multiple Operation in If condition

I want to insert a item in login history table , if login get success and next i want to redirect home page. But here If i am entering wrong password also, I am redirecting to home page and then only showing me the error called "Login Failed". Please help me to fix it. I think I am doing something mistaken in my code .Please help. 

 

 

ErrorCode.JPG

1 ACCEPTED SOLUTION

Accepted Solutions
Super User III
Super User III

Hi @rswain44 ,

That is because you are trying to query something that is not yet written. Try this

If(
   !IsBlank(
      Lookup(
         'User Login',
         txtUserName.Text=Title &&
         txtPassword.Text=Password,
         txtPassword
      )
   ),
   Patch(
      AccessLogs, 
      Defaults('AccessLogs'),
      {
         Title: txtUserName.Text,
         LoginTime:Today()
      }
   );
   Navigate(Dashboard,None), 
   Notify("Incorrect Login Details",NotificationType.Error)
);
Reset(txtUserName);
Reset(txtPassword);

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

2 REPLIES 2
Super User III
Super User III

Hi @rswain44 ,

That is because you are trying to query something that is not yet written. Try this

If(
   !IsBlank(
      Lookup(
         'User Login',
         txtUserName.Text=Title &&
         txtPassword.Text=Password,
         txtPassword
      )
   ),
   Patch(
      AccessLogs, 
      Defaults('AccessLogs'),
      {
         Title: txtUserName.Text,
         LoginTime:Today()
      }
   );
   Navigate(Dashboard,None), 
   Notify("Incorrect Login Details",NotificationType.Error)
);
Reset(txtUserName);
Reset(txtPassword);

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

Thanks @WarrenBelz 

Now its working as expected . I just update your 1st line of code and its working fine. 

error.JPG

Helpful resources

Announcements
News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

Power Apps Community Call

Power Apps Community Call- January

Check out the Power Apps Community Call for January 2021

PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

Top Solution Authors
Top Kudoed Authors
Users online (3,765)