What you can do with this component
- Remove the first n characters from the barcode
- Remove the last n characters from the barcode
- Replace parts of the barcode
- Extrapolate the data encoded inside the barcode
To do that, Drag & Drop the component from the Available components field to the Output components field by keeping pressed the left mouse button.
Step 3 – Add variables
For example if you use the barcode variable, you’ll have to insert also a component in the Output template field.
Then to prevent the BARCODE component to interfere with the final output value, enable the Skip Output option.
Let’s say that you want to remove the first character of the barcode
Initial barcode: 0897654321
Final output: 897654321
Follow these steps:
- Add a component just after the component
- Enable the Skip output option of the component
Extrapolate parts of the barcode
Initial barcode: 433-0132-22
Final output: 0132
Replace a specific part of the barcode
Initial barcode: first_name:john;last_name:doe
Final output: name:john doe
barcode.replace('first_name:','name:').replace('last_name:', ' ')
Tip 1: to remove a specific part of the barcode you can use the replace() method, and pass an empty string as second parameter, for example:
Tip 2: you can use a regular expression as first parameter, for example
barcode.replace(/w/gi, '') will perform a global, case-insensitive replacement of the w character.
Extract a parameter from an URL
Initial barcode: https://example.com/?user_id=123&tracking_id=RN015215156&order_id=456
Final output: RN015215156