Number To Letter Convertor For Barcode

XS - 2419
S - 19
M - 13
L - 12
XL - 2412
XXL - 242412
XXXL - 24242412

All sizes above.

No It can be of 6, 7, 8 as per stock change and designs change.

No the code can be anything in the future,
At the moment the max letter of code are 5 but in future it can be less or can be more. I am talking about KJD, KWTSR and more from above list.

The sizes are different mentioned above in this post.

Each time it starts from letter K, this letter is fixed.

Yes you are absolutely correct, I store and get these values from firebase database.

I already done this work, I need to get this data by barcode after scanning.
As I already said above.

The dictionary approach would work well with the advanced text replace block, using the option to choose longest replacement.

You could force replacements to happen at the front or end by adding a special character like '%' at the front or end of both the keys and the text.

To get the middle part, use the dictionary approach to change whatever matched to an empty string, front and back.

2 Likes

Perhaps something like this:

decodeBarcode.aia (3.9 KB)

of course there will be trouble if the beginning or the end of the item code (the bit in the middle), goes to make up a part of one of the dictionary keys

It may also help if we know the range of the item codes (the bit in the middle) e.g. 00001 - 59999.

1 Like

Please help with this also, I can save the value in firebase for it if the codes digits are 240034 I save in firebase only 6 digits and if it increase i can do that also.

You have now increased to six digits ?

What is the range (where do the codes start and finish) ?

No, I am giving example if the between digits may increased in future we can set the dynamic method for the app to not crash. If the digits are 5 we simply enter in firebase 5 and if 6 then enter 6 in firebase
(but if 6 entered app will also need to work with smaller digits in between KJD like codes and sizes like XS,S,M and so on)

You are saying there is no range of number for the item codes ?

Doesn't sound like there is a plan...

This is built on @TimAI2's dictionaries:

image
decodeBarcode (1).aia (3.5 KB)

2 Likes

Will this still have the problem of the itemCode consuming either the productCode or the sizeCode ?

For example if the itemCode is 22424 and the size is L (12), then this would capture size XXL.

Maybe for the suffix using the other option of the translate block (dictionary order) might help.

But there is no assurance that this coding scheme is entirely one to one, as you pointed out.

This is basically a hash code.

It's up to the person creating the code from the three parts to check if that code is already taken.

We all are doing well on this project, and it will also helps others to decode the barcode like this.

Can we save the string like this in firebase to help this work easy for us,

for sizes :
Tag = M, Value = %13
Tag = L, Value = %12

for Codes like KJD, KWTSOS :
Tag = KJD, Value = 11104%
Tag = KWTSR, Value = 112320191519%

by the percent sign or any separator we can separate them,
as the value of sizes are absolutely fixed no other sizes manufactured above this.

But codes like KJD, KWTSR and KWTSOS are not fixed or they can be approx any length,

But we also can manage this, as we are using seperator to separate sizes already we only need to get the between code after this which can be of any range we do not need to handle this, we need to handle the productCode and Sizes only.

As @ABG also suggests, the way forward will be to be able to first test and extract the item code.

Are you unable to provide the method used (or the range) to define an item code ? (the bit in the middle)

So you have influence over how the bar codes are generated?

Are the bar codes allowed to have non numeric codes in them?

That would make splitting them trivial.

Yes, I have full control on the the barcode generation.

the barcode generation process is to replace letter in number format(from alphabets 1-26 series) and replace number between as it is they are.

Screenshot 2024-09-02 143233

Never, barcodes always generated in numerical formats

ItemCode cannot be defined, it is as per manufacturer's choice.
The range can be increase in the future after 999999

Do you have a database / list of all the item codes?

It may be possible to run a routine on the remaining digits after getting the product and size codes, to find a match in that list. If no match, then to test for any collisions by iterating over any possible options.

Why this error came?