February 9, 200718 yr Our company makes vitamins. We have lots of powders and keep track of the batches used in production. The idea is that the mixing in charge scans the barcodes of the batches into a field. Each barcode is always a length of 8 characters. If he scans 3 barcodes, the field will be 24 characters long. I am trying to create a function that will reformat the text like so from: xxxxxxxxxxxxxxxxxxxxxxxx to xxxxxxxx, xxxxxxxx, xxxxxxxx I cannot get the function to work. it would be a text field with a calculation to reformat the text. Any help is appreciated.
February 9, 200718 yr Try: Replace ( Replace ( text ; 9 ; 0 ; ", " ) ; 19 ; 0 ; ", " ) How come the scanner doesn't tab into next field at the end of a scan? EDIT: Wait, you mean the field can contain ANY number of scans? If so, you will need a custom function for this. Once again, it's weird that the scanner cannot at least insert a separator. Edited February 9, 200718 yr by Guest
February 9, 200718 yr Author yes, it can contain any number of characters, always in groups of 8. a custom function is exactly what i need. I made one that works for 2 barcodes or less but after 2, it goes wild. this is the calculation: function CommaEight(text) -------------------------- Let( length = length(text); If( Length(text) > 8; CommaEight(text) & ", " & Right(text;Length(text) - 8); text )
February 9, 200718 yr Try it this way: Let ( [ this = Left ( text ; 8 ) ; len = Length ( text ) ; rest = Middle ( text ; 9 ; len - 8 ) ] ; this & Case ( len > 8 ; ", " & CommaEight ( rest ) ) )
February 9, 200718 yr Author you are the bomb. i bow down to thee. _|-0 it's a man bowing down. get it?
Create an account or sign in to comment