cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
Highlighted
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
Highlighted
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?

Highlighted

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. 

Highlighted
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

Highlighted

hi @timl ,

 

You are right, problem is resolved.

 

Thank you.

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

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

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (15,946)