cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Sahara22
Post Patron
Post Patron

Using the "Left Function" with LookUp

Hello, I need please the first 12 Left Charters only and was looking for help how to do so with the following statement: 

"House'=LookUp(

          Table2,

          HouseID=(Right(BarcodeScanner1.Value,Len(BarcodeScanner1.Value)-2))

      ).LOCATION1)); <-- Here it where I need help please. 

 

I know that Left (LOCATION1.text,12) would be how to do this but not sure how to do this in this kind of statement.

 

Thank you. 

 

5 REPLIES 5
gabibalaban
Dual Super User
Dual Super User

Hi @Sahara22 ,

Left(
   LookUp(
      Table2,
      HouseID=Right(BarcodeScanner1.Value,Len(BarcodeScanner1.Value)-2)
   ).LOCATION1,
   12
);

Hope it helps !

Sahara22
Post Patron
Post Patron

Hi There,

 

Thank you for you help.

 

Unfortunately it didn't work. 😞 Maybe I Need to set this a variable on its own?

 

Thanks  

Threepointz
Frequent Visitor

Consider simplifying your code for testing, then adding one element at a time.  Basically you're trying to get the leftmost characters of a calculation, so enter the expected result and see if the Intellisense complains, then add in one variable or sub-calculation at a time.

Example

Left(Right("12345678901234567890",14),12)

then

Left(LookUp(

          Table2,

          HouseID="whatever the actual address returned by the scanner should be" ).LOCATION1), 12)

etc. so that you're only testing one element of the formula at a time, not multiple calculations and operations.

That way you can isolate where the error is.  But Left(LookUp(sometable,somefield="somevalue").someotherfield, 12) works so you shouldn't need an intermediate calculation for the lookup result.

@Sahara22,

In my understanding, you want with the BarcodeScanner value without the first 2 chars to Lookup into table2 for equivalent houseID and use the first 12 chars of Location column of the resulted row.

What do you want to do with this value ? To keep it in a context variable ? To use it as text property of a label control ? 

Sahara22
Post Patron
Post Patron

Thank you so much for the replies back, I will test and get back to you! 

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Top Solution Authors
Top Kudoed Authors
Users online (1,511)