cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
SOng8
New Member

Barcode Scanner

Hi,

I'm designing Power App to scan WOID. Before patching into Table 1, it needs to look up Column WOID to ensure no duplication. The formula (attached below) doesn't seem to be working correctly. Any help and advise would be very much appreciated. 

Thanks.

 

If(
IsBlank(
LookUp(
Table1,
WOID = BarcodeScanner6.Text
)
),
Navigate(
Error,
ScreenTransition.None
),
Navigate(
Successful,
ScreenTransition.None
);
Patch(
Table1,
Defaults(Table1),
{
Activity: "WO Collection",
WOID: BarcodeScanner6.Text,
Timestamp: Now(),
Username: User().FullName
}
)
)

1 ACCEPTED SOLUTION

Accepted Solutions
timl
Super User III
Super User III

Hi @SOng8 

Isn't the logic here just the wrong way round? If the result of the lookup is blank (ie, there isn't a record that matches the WOID value in table 1, you want to patch a new record?

I would also recommend that you patch the new record before navigating to 'successful' screen.

 

If(IsBlank(LookUp(Table1,
               WOID = BarcodeScanner6.Text
           )
   ),
   Patch(Table1,
      Defaults(Table1),
      {
       Activity: "WO Collection",
       WOID: BarcodeScanner6.Text,
       Timestamp: Now(),
       Username: User().FullName
       }
     );
   Navigate(Successful,ScreenTransition.None),
   Navigate(Error,ScreenTransition.None)
)

 

View solution in original post

4 REPLIES 4
timl
Super User III
Super User III

Hi @SOng8 

Can you clarify what isn't working here?

Is it not finding the record in Table1 and navigating you to the error screen, or is it not patching the record correctly?

Hi Tim,

 

Thanks for the quick respond.

The lookup isn't working, it doesnt respond correctly to Navigate accordingly. The patch is working well, I have removed other logic to test just the patch. 

timl
Super User III
Super User III

Hi @SOng8 

Isn't the logic here just the wrong way round? If the result of the lookup is blank (ie, there isn't a record that matches the WOID value in table 1, you want to patch a new record?

I would also recommend that you patch the new record before navigating to 'successful' screen.

 

If(IsBlank(LookUp(Table1,
               WOID = BarcodeScanner6.Text
           )
   ),
   Patch(Table1,
      Defaults(Table1),
      {
       Activity: "WO Collection",
       WOID: BarcodeScanner6.Text,
       Timestamp: Now(),
       Username: User().FullName
       }
     );
   Navigate(Successful,ScreenTransition.None),
   Navigate(Error,ScreenTransition.None)
)

 

View solution in original post

hi @timl ,

 

You are right, problem is resolved.

 

Thank you.

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,968)