This will give you way more flexibility if it comes processing your logic.
The barcode widget is probably doing what you need. Make sure you are on a page that has as property Platform: Native. On such a page right click → Add widget… → type barcode and select the widget. Fill its parameters and you should be good to go.