Convert every letter from an Input to Letter+Number

Hi all!

I am so very stuck on the following thing. A little help will be life and time saving!

I want to write letters in an Input and if there is a matching letter to number it with the number, corresponding to the number of the repetition.

Let’s say the user writes ALPACA and on another text field the result is A1 L1 P1 A2 C1 A3

I am new to bubble and like it very much so far but this problem is taking all my time.

Thanks in advance to anyone bother helping me!

Damn!

This sounds like @adamhholmes challenges :rofl:

Can we use JavaScript for this one? :sweat_smile:

2 Likes

Maybe it is important to mention that I want to use this to transfer the data to a repeating group on another page and every used letter to be placed in a cell with a corresponding data from my database.
I have done everything pretty problemless but my issue is that when I have 2 or more of the same result, in the repeating group is shown only the first entry from my database.

After a lot of headbanging I’ve thought that this method with numbering the repeating letters will be the most effective.

Maybe I am wrong :upside_down_face:

Every :poop: ing day I see a new example why we need a “Create a list of things” action so you can generate a thing in your database per letter, and work with actual Things instead of trying to cobble together letters and numbers

Use @keith’s list shifter to create a list of numbers of the same length as the number of characters in your input.

Then in your workflow:

Trigger: When input value is changed.

Make changes to thing:

-List of numbers: format as text
—For each item: “input value:extract with regex “\w”: item#: this number. This number.”
—Delimiter: “+”
-Split by “+” (turn it back into list)

Save list in your database.

This will result in a list like this: A1 L2 P3 A4 C5 A6

Every value will be unique, so Bubble won’t remove any as duplicates, which is what is happening to you now.

When displaying the letter, just truncate to 1 to show only the letter.

1 Like

Thanks but this is not my purpose.

I managed to get this result without a 24$ plugin.

My problem comes after that on the next page where I have 3 A’s and the corresponding data entry has to be A1(some text), A2(some other text) and A3(some other text), no matter of what position in the input the A is.
Now I get A1, A1, A1.

To be honest I don’t know if my logic is correct, I’ve tried with options sets, or with some custom states like - isUsed=true/false but every time the result is just A1, A1, A1 or A2,A2,A2 or A3,A3,A3.

Whatever it takes :joy:

I’m really confused about your use case. Why would what I suggested not work? Aren’t you just trying to get unique elements in your list?

I want to make a children’s book where the user types the child’s name and for every letter of the name there is a corresponding page with that letter. (like a website called Wonderbly)
So for that I want to transfer the string from the name to the next page. And if the name contains one A the page should be exactly for the first A. If there is a second A in the name I want the page to be exactly for the second A etc…

My explanation is a bit messy but I hope it is somehow understandable.

Some ideas.

Editor

Preview

1 Like

Thanks man!

One thing - I do not have permission to view the Editor. Can you please change that so I can see if this works for me :slight_smile:

Done!

I’ve managed to do this by myself but my problem remains.

I want to extract the information that there are exactly 3 A’s in the input and to assign different data for A1, A2 and A3.

Thanks again for taking your time to trying to help me.

Have you tried using JS?

Code Example

1 Like

Wow this seems to work!

Now my problem is that I am really new to bubble and building apps (I am a game designer and have a mediocre knowledge in C#) and have no idea how to implement javascript in my app.

I think for your use case you’re going to really want to create things for every letter.

You can create an API workflow that creates them and then schedule it on a list with 0 in between and it will probably create all of them in under a second in most cases.

Please Bubble :sob: @josh

1 Like

Thanks!
It is working, I’ve learned how to implement the JS code.

And then there is another issue… When I try to send the result from the output as an URL parameter it sends nothing…

This worked! Just at the end the result should be printed in the JS element’s value because if it directly on a text field with ID Attribute then it is not accessible by bubble and can not extract the value or string.



1 Like

Yeah, it was just an example of an approach to be implemented. The result needed to be exposed. Happy to know it worked!