Delta Tango Posted February 9, 2007 Posted February 9, 2007 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.
comment Posted February 9, 2007 Posted February 9, 2007 (edited) 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, 2007 by Guest
Delta Tango Posted February 9, 2007 Author Posted February 9, 2007 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 )
comment Posted February 9, 2007 Posted February 9, 2007 Try it this way: Let ( [ this = Left ( text ; 8 ) ; len = Length ( text ) ; rest = Middle ( text ; 9 ; len - 8 ) ] ; this & Case ( len > 8 ; ", " & CommaEight ( rest ) ) )
Delta Tango Posted February 9, 2007 Author Posted February 9, 2007 you are the bomb. i bow down to thee. _|-0 it's a man bowing down. get it?
Recommended Posts
This topic is 6558 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now