Forum Academy Marketplace Showcase Pricing Features

Splitting text data from an Open AI API call

Hello lovely people.
Urgent help needed :sob:

I am using Open AI to receive dynamic text data via an API call. All is working fine, except that I will like to choose which line/section of the received data to display in my text element in Bubble as I will like to control what part of this data I display at various sections of the text element. I have tried the ‘split by’ function, but that did not work ( or I may be doing it wrong). Can anyone please help?

Attached below is the API response in its raw format and how it is presently displayed in my text element in Bubble. I have also attached my workflow for this.
In the attached text element image, I want to only display the CV summary and not the skills set and then display the skill set on another element when I want to without displaying the CV summary. In other words, I want to split them.

How did you tried? And what was the result?

Hello Chief. Thanks for your quick reply.
Please find below my use of the ‘split by function’ and its results attached.
As shown by the attached image, Bubble brings up an error message when I try the ‘split by function’ as it says I need to display it as a single text and not as a list of texts.
I feel I am really close to cracking it, but its now very frustrating. Any help will be fully appreciated.

When you splited the text your created a list of texts.

If I split the text “Hello, my name is Rafael, what is your name?” by comma (","), Bubble will create the following list:

item #1: Hello
item #2: my name is Rafael
item #3: what is your name?

So what you need to do is to know what element of your list contains the part ot the text you want.

Try to finish your sentence with :item #2 to see the result :wink: By doing this, you will tell Bubble that you want the second element of your list.

1 Like

You could also try adding “:extract with regex” after “:split by” action to see what happens.

HI! try to extract strings by regex like : text:extract by regex [^\n]+ (that will split every row which ends by /n) after that you need to select a item#1 or item#2