Identify The Number Of Characters And Input Results Into The Desired Fields

Hey Everyone,

I have a challenge. I have a barcode scanner to assist with prefilling a form for orders. I have the scanner results in a field and I would like to identify a character (%) from the results and choose the number of characters then input the information after the desired number of characters to input it into the desired field.

For example this is the scanner results:
%MVL16C07%01523%404A033%1%404800331DBGK%CNN12WLGP%FHX3728L%Station wagon / Stasiewa%TOYOTA%FORTUNER%Silver / Silwer%AHTYZ59G908023129%1KDA133669%2018-07-31%

These are the number of characters for the fields I need populated:
Vehicle Make: (After 9th %) TOYOTA
Vehicle Model: (After 10th %) FORTUNER
Vehicle Year: (After 14th %) 2018
VIN: (After 12th %) AHTYZ59G908023129
Vehicle Colour: (After 11th %) Silver

Looking forward to seeing the community suggestions.

Hi there, @carson.b… it will not surprise some folks (or at least one folk, in particular) that I am about to recommend the :split by operator to you. Yup, I really dig that operator. :slight_smile:

You should be able to split the results by the % character, and then you can add the :item # operator to the expression to get a specific item from the split.

Hope this helps.

Best…
Mike

1 Like

incredibly simple solution! I just started using bubble this year. I read one of your solutions to another post where you used the Toolbox plugin, to achieve a slightly similar result. Thanks for your help :ok_hand:

1 Like

Hey There Mike, One of my fields is a dropdown list with an option set. How can I set the default value of the dropdown list to the value from the scanner raw data that is split by the %?

Get all of the options from the option set and use the :filtered operator to filter to the option that matches the item from the split.

1 Like

Thank you for the help, it works :+1:

1 Like

This topic was automatically closed after 69 days. New replies are no longer allowed.