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
User Groups Public Preview

Join us for our User Group Public Preview!

Power Apps User Groups are coming! Make sure you’re among the first to know when user groups go live for public preview.

Power Apps Community Call

Monthly Power Apps Community Call

Did you miss the call?? Check out the Power Apps Community Call here!

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (57,273)