How to scan some parts of the QR Code?

Hi,

I have lots of tools that are tagged such as the following

RC-B21-1-5
TB-R23-15-2
DR-R21-21-1

However, i want the scanner to only scan the code prior to the 2nd last โ€˜-โ€™

So u would want

RC-B21
TB-R23
DR-R21

Can anyone help me this? Thank you!

Solved Solved
0 12 699
1 ACCEPTED SOLUTION

Thank you for shining the light of the rising sun on my dim heart. This worked perfectly!

View solution in original post

12 REPLIES 12

Hi @Zikri_Zainal Maybe you could add another column and extract those 6 digits using LEFT eg LEFT([Barcode col],6)

Thank you Lynn

I forgot to mention some codes have more than 6 letters at the front. Ie

SB250-R19-2-1
SE3-R19-1-1

So they are not regular. How do i go about this?

Thank you

Ahh, You will need a more complicated formula then. Possibly using FIND to find the second -

Try SUBSTITUTE((TOP(SPLIT([Column], "-"), 2) & ""), " , ", "-").

LEFT(โ€œSB250-R19-2-1โ€ , FIND("-" , โ€œSB250-R19-2-1โ€)+3)

would give you

SB250-R19

This is usable if the โ€œR19โ€ part has always 3 characters.

Assuming all the code is constructed with 4 parts separated by 3 of โ€˜-โ€™, like those.

column name = [QR_Code]
RC-B21-1-5
TB-R23-15-2
DR-R21-21-1
SB250-R19-2-1
SE3-R19-1-1

If this is the case, probably following expression could help, although i m not testing yet.

index(split([QR_code],โ€™-โ€™),1)&โ€™-โ€™&index(split([QR_code],โ€™-โ€™),2)

โ€“

Using split expression will generate something like ARRAY out of the original test.
You always would like to first 2 parts of the text , so just take one by one using index expression.
Then contact two parts to get the texts in your required format.

This expression does not care how many characters each part of code is comprised of.

This is kind of playing with codeโ€ฆ object and arrayโ€ฆ

@tsuji_koichi Very nice. Thank you!

I just tried it and it is working. Will surely need it in the future

index(split("RC-B21-1-5",'-'),1)&'-'&index(split("RC-B21-1-5",'-'),2)

Gives you RC-B21

By the way: I didnโ€™t know that we can also use single quote ' instead of double quotes " in expressions

Hi Fabian,

Glad to hear you love this trick.
I think we have load of use cases with this .

Yes, single quote is also work.

Indeed, you can get away with things like this:

concatenate(โ€™"โ€™, โ€œMy quote hereโ€, โ€˜"โ€™) which will give you: โ€œMy quote hereโ€

If you encapsulate the double quote in single quotes (kinda hard to see this in the formula), the system ignores the double quote inside the single quote - single quotes are a way of saying โ€˜this is text, itโ€™s always text.โ€™

Thank you so much! Will definitely try this!

Thank you for shining the light of the rising sun on my dim heart. This worked perfectly!

You are welcome.

Top Labels in this Space