# Populate DB with content present on a custom state, present inside a repeat group

**URL:** <https://forum.bubble.io/t/populate-db-with-content-present-on-a-custom-state-present-inside-a-repeat-group/146500>\
**Category:** Questions\
**Created:** [April 15, 2021, 2:32pm UTC](https://forum.bubble.io/t/populate-db-with-content-present-on-a-custom-state-present-inside-a-repeat-group/146500 "2021-04-15T14:32:22Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![italogmoura](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/italogmoura/32/102621_2.png) [@italogmoura](https://forum.bubble.io/u/italogmoura)\
**Post date:** [April 15, 2021, 2:32pm UTC](https://forum.bubble.io/t/populate-db-with-content-present-on-a-custom-state-present-inside-a-repeat-group/146500/1 "2021-04-15T14:32:22Z")

</div>

I have two elements inside of a repeating group. One **multilineinput** and a **text element**. The text element is populated for a custom state present on the repeating group named “tagrepeat”, which receives data from an API.

 ![image](https://us1.discourse-cdn.com/bubble/original/3X/9/e/9e9afba71ed365fd26c02efe04c2d1a50c665c7c.png)

I created a button to send the content present at the custom state “tagrepeat” to a field present on the database named “tag”. This works great:

![image](https://us1.discourse-cdn.com/bubble/original/3X/e/a/ea819488ad1fbd2282ce9d85949664f86bd813e2.png)

**The problem** is that I cannot do the same with the multilineinput. I tried creating a new custom state to the repeating group named “question” to associate to multilineinput, but do not worked.

 ![image](https://us1.discourse-cdn.com/bubble/original/3X/d/a/da846c993b73f5eaf9502b7369c9b408f23ab013.jpeg)

When I click at the button to send the content present at the custom states to data base, just the content of “tagrepeat” go-to database.

![image](https://us1.discourse-cdn.com/bubble/original/3X/4/b/4b8016228948a9f56a00c379474e878749e7352b.png)

Can someone say what I am doing wrong?

@rico.trevisan 🙃

---

<div class="post-metadata">

**Author:** ![launchable](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/launchable/32/91733_2.png) [@launchable](https://forum.bubble.io/u/launchable)\
**Post date:** [April 15, 2021, 2:47pm UTC](https://forum.bubble.io/t/populate-db-with-content-present-on-a-custom-state-present-inside-a-repeat-group/146500/2 "2021-04-15T14:47:52Z")

</div>

Hey @italogmoura,

Are both fields, for your Flow Thing / data type, defined as Text Lists?

And are you getting any error output, either in your browser window or server logs, when you click the button to trigger the workflow? My first guess is that there is a data type mismatch between what is in the repeating group, and what is in the database.

Another question: are you triggering an API call, which creates the tagrepeat, and later trying to add the tagrepeat and the question to the database? I’m trying to wrap my head around the sequence.

This probably doesn’t solve your problem, but maybe helps clarify? lol

---

<div class="post-metadata">

**Author:** ![italogmoura](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/italogmoura/32/102621_2.png) [@italogmoura](https://forum.bubble.io/u/italogmoura)\
**Post date:** [April 15, 2021, 3:21pm UTC](https://forum.bubble.io/t/populate-db-with-content-present-on-a-custom-state-present-inside-a-repeat-group/146500/3 "2021-04-15T15:21:18Z")

</div>

1. Yes. Both are defined as Text Lists when I create the custom state.

2. No, there is no error message. But I agree with you that problem probably is something mismatched.

3. Perfect. I am triggering an API call, which creates the “tagrepeat” (custom state inside one repeating group). Later, I am trying to add the “tagrepeat” AND the “question” (value typed for the user on a input text) to the database, this time when a button is clicked.

---

<div class="post-metadata">

**Author:** ![launchable](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/launchable/32/91733_2.png) [@launchable](https://forum.bubble.io/u/launchable)\
**Post date:** [April 15, 2021, 3:24pm UTC](https://forum.bubble.io/t/populate-db-with-content-present-on-a-custom-state-present-inside-a-repeat-group/146500/4 "2021-04-15T15:24:37Z")

</div>

For point 1: are they defined this way in the database too?

Something else to consider: You’re using the “add” method, to stick those tagrepeats and question on to an existing database entry, rather than creating a new entry. I’m not sure what you’re doing with the data, so this may not make sense, but you could try creating a new Flow with those two fields, when you click the button.

Maybe a few more screenshots of your interface and workflow could help?

Sorry if I’m just missing something, and pulling in the wrong direction 🙃

---

<div class="post-metadata">

**Author:** ![italogmoura](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/italogmoura/32/102621_2.png) [@italogmoura](https://forum.bubble.io/u/italogmoura)\
**Post date:** [April 15, 2021, 5:22pm UTC](https://forum.bubble.io/t/populate-db-with-content-present-on-a-custom-state-present-inside-a-repeat-group/146500/5 "2021-04-15T17:22:23Z")

</div>

You can edit here.

Click in preview and take a look. Click on get data, type something on the input and click on send to a database. After this, take a look at the app’s data. Just the field received from the API call went to the database. The input did not.

[Testandomyapp | Bubble Editor](https://bubble.io/page?type=page&name=teste&id=testandomyapp&tab=tabs-1)

---

<div class="post-metadata">

**Author:** ![launchable](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/launchable/32/91733_2.png) [@launchable](https://forum.bubble.io/u/launchable)\
**Post date:** [April 16, 2021, 2:53am UTC](https://forum.bubble.io/t/populate-db-with-content-present-on-a-custom-state-present-inside-a-repeat-group/146500/6 "2021-04-16T02:53:42Z")

</div>

Hi again @italogmoura,

This was pretty tricky, but I think found a solution. It’s a bit hacky, and there is probably a cleaner solution, but this works, so that’s a start 🙂

When you first call the API, you can set the State\_UserComments list to also be the state names. Then, set up a workflow action, so that when the multi-line input is changed, the State\_UserComments list is changed, using a find and replace, replacing the cell’s state abbreviation (which is also the UserComment, initially), with the content of the multi-line input. See screenshot, or check your demo app for more details.

 ![db_ss](https://us1.discourse-cdn.com/bubble/original/3X/c/a/ca2392e7d3524932a4a5d12ae947bca00fe180c3.png) ![workflow_ss](https://us1.discourse-cdn.com/bubble/original/3X/7/e/7e155e08387cfce8c8b048422cf11da1a82d3dc7.png)

First screenshot is a successful write to the DB, with the fields changed; second SS is the workflow action to set up the multi-line input.

As far as I can tell, it’s non-trivial to replace an item in a list at a specific index, though if someone else knows how to do this, please chime in: it would make this much more straightforward.

Let me know if this works, or if I can further clarify.

Good luck! I’m not sure what you’re planning with this, but it seems you’re working in the right space 👩‍🔬

---

<div class="post-metadata">

**Author:** ![italogmoura](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/italogmoura/32/102621_2.png) [@italogmoura](https://forum.bubble.io/u/italogmoura)\
**Post date:** [April 16, 2021, 11:47am UTC](https://forum.bubble.io/t/populate-db-with-content-present-on-a-custom-state-present-inside-a-repeat-group/146500/7 "2021-04-16T11:47:04Z")

</div>

Take a look at this plug-in. A easy way to solve this problem: [New free plugin (9 march/20) - Orchestra! Refer to inside repeating groups cell(s) from outside](http://forum.bubble.io/t/new-free-plugin-9-march-20-orchestra-refer-to-inside-repeating-groups-cell-s-from-outside/81400)

Anyway, would be amazing to do this without a plugin.

---

<div class="post-metadata">

**Author:** ![jared.gibb](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/jared.gibb/32/123329_2.png) [@jared.gibb](https://forum.bubble.io/u/jared.gibb)\
**Post date:** [April 16, 2021, 1:07pm UTC](https://forum.bubble.io/t/populate-db-with-content-present-on-a-custom-state-present-inside-a-repeat-group/146500/8 "2021-04-16T13:07:19Z")

</div>

Here is an example of recursion. I save a bunch of scores in a repeating group and sometimes I don’t want to set a score for a given task. So if there’s not a given score I don’t wanna save that variable. Here’s one way that I have saved items from a list.

> **[Bubble - Visual Programming](https://customstateduplicateissue.bubbleapps.io/version-test?debug_mode=true)**
>
> Build stuff without code and launch a startup without a tech-cofounder! Bubble is a visual programing language. Instead of typing code, use a visual editor to build applications.

Another would be to use the orchestra plug-in. It is very simple and I use it to save the same stuff just in a more convenient manner. I can share screenshots of that later if you would like

---

<div class="post-metadata">

**Author:** ![italogmoura](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/italogmoura/32/102621_2.png) [@italogmoura](https://forum.bubble.io/u/italogmoura)\
**Post date:** [April 20, 2021, 1:50pm UTC](https://forum.bubble.io/t/populate-db-with-content-present-on-a-custom-state-present-inside-a-repeat-group/146500/9 "2021-04-20T13:50:00Z")

</div>

Hello. I need to do the same. Could you share a demo in Bubble editor with me? Thaks a lot
