# How can I store a series of text?

**URL:** <https://forums.unrealengine.com/t/how-can-i-store-a-series-of-text/412986>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine\
**Created:** [December 23, 2017, 2:25pm UTC](https://forums.unrealengine.com/t/how-can-i-store-a-series-of-text/412986 "2017-12-23T14:25:22Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![yuyake79](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@yuyake79](https://forums.unrealengine.com/u/yuyake79)\
**Post date:** [December 23, 2017, 2:25pm UTC](https://forums.unrealengine.com/t/how-can-i-store-a-series-of-text/412986/1 "2017-12-23T14:25:22Z")

</div>

Hi,  
I’d like to be able to store names and numbers which the user can input and then be able to display them in a vertical box within a widget. At the moment I can get the user to type in the names and numbers within a widget which then gets passed to another widget’s vertical box using an _Add Child To Vertical Box_ as shown below.

 ![224868-addchild.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/c/0/bc0236d889de1141cfd10fb234fdb2894cfbf94e.jpeg)

But I don’t know how to store every single user input. I am only able to store the last user input in a string variable. I’d like to be able to store every single input, in the order of each entry, so when the application/game starts again it can get loaded and displayed in a widget’s verticle box.  
Any help would be really appreciated.

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [December 23, 2017, 2:41pm UTC](https://forums.unrealengine.com/t/how-can-i-store-a-series-of-text/412986/2 "2017-12-23T14:41:18Z")

</div>

Create an array of string variables. Every time the user types a message and hits enter, add it to the array. You can then read the array and add widgets to the vertical box in a loop.

---

<div class="post-metadata">

**Author:** ![yuyake79](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@yuyake79](https://forums.unrealengine.com/u/yuyake79)\
**Post date:** [December 27, 2017, 11:55am UTC](https://forums.unrealengine.com/t/how-can-i-store-a-series-of-text/412986/3 "2017-12-27T11:55:27Z")

</div>

Thank you Everynone,  
I think I managed to add each input into a string array. But I am not sure how to add that to a vertical box. I was wondering if I could keep this simple by using a widget switcher, all within the same widget, instead of two separate widgets as I first mentioned above.  
Would it be possible to do it all within the same widget using a widget switcher? Let me show you what I mean below.

 ![225166-addarraytovbox2.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/0/6/40617fac6a151f13bb57e9a98bb71d825e6d9542.jpeg)

 ![225167-addarraytovbox1.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/7/a/57aef5ef93ed58aadf32f2ae58ade61a720831c8.jpeg)

 ![225168-addarraytovbox3.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/b/1/1b18e13cfd133ff2a321fb9d3ad790d40b03b06a.jpeg)

The user types something (in the first image) and _ **on text committed** _ it switches widgets and the input gets added to the array. And then I would like the accumulated input within the array to get added to the _vertical box_ in the widget I switched to (in the second image). But I’m not really sure how to do that.

---

<div class="post-metadata">

**Author:** ![DWGS](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@DWGS](https://forums.unrealengine.com/u/DWGS)\
**Post date:** [December 27, 2017, 11:59am UTC](https://forums.unrealengine.com/t/how-can-i-store-a-series-of-text/412986/4 "2017-12-27T11:59:08Z")

</div>

An alternate method is to use a data table and get datatable row by name.Youll need a struct to do so, more info [here.](https://wiki.unrealengine.com/Using_excel_to_store_gameplay_data_-_DataTables)

---

<div class="post-metadata">

**Author:** ![yuyake79](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@yuyake79](https://forums.unrealengine.com/u/yuyake79)\
**Post date:** [December 27, 2017, 1:01pm UTC](https://forums.unrealengine.com/t/how-can-i-store-a-series-of-text/412986/5 "2017-12-27T13:01:10Z")

</div>

Thank you, Newest.  
I thought data tables are _read-only_, as in the user cannot edit them in run time and only get data from them once already created. I would like the user to, for example, be able to add names to a list and to be able to do so an unlimited number of times. Would the user be able to add extra rows in-game using a data table?  
With arrays, I noticed that they were dynamic where the user is able to add extra names to a string array in-game.

---

<div class="post-metadata">

**Author:** ![salm](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@salm](https://forums.unrealengine.com/u/salm)\
**Post date:** [December 27, 2017, 4:38pm UTC](https://forums.unrealengine.com/t/how-can-i-store-a-series-of-text/412986/6 "2017-12-27T16:38:02Z")

</div>

Are you sure you want VerticalBox? VerticalBox is a widget container for buttons, textboxes, and stuff like that. These docs cover what you’re asking for: [Creating Widget Templates | Unreal Engine Documentation](https://docs.unrealengine.com/latest/INT/Engine/UMG/HowTo/WidgetTemplates/).

Basically, you would have a seperate BP widget w/ only a TextBox, and then in your main widget you would add the TextBox widget to your Vertical Box.

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [December 27, 2017, 8:32pm UTC](https://forums.unrealengine.com/t/how-can-i-store-a-series-of-text/412986/7 "2017-12-27T20:32:29Z")

</div>

@yuyake79 What you’re trying to accomplish is perfectly doable. What kind of widget do you want to add to the vertical box? Just a text block?

While you cannot dynamically spawn text blocks, there is a simple solution. Create a custom widget that holds just a single text block with an exposed variable (I called it _VerticalBoxLine_ here). Then you can populate the vertical box by spawning lines of text like so:

 ![225224-capture.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/c/b/dcbfb0572253b3a4ec56baa0807fa2cd664da1b5.png)

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [December 27, 2017, 8:42pm UTC](https://forums.unrealengine.com/t/how-can-i-store-a-series-of-text/412986/8 "2017-12-27T20:42:56Z")

</div>

yuyake79 is right here. You can’t write to DataTable unless you do some heavy lifting in C++.

---

<div class="post-metadata">

**Author:** ![yuyake79](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@yuyake79](https://forums.unrealengine.com/u/yuyake79)\
**Post date:** [December 28, 2017, 3:56am UTC](https://forums.unrealengine.com/t/how-can-i-store-a-series-of-text/412986/9 "2017-12-28T03:56:15Z")

</div>

Yes, it was just a text block that I wanted to add to the vertical box.  
I am attempting this solution you have here. How did you add that extra string pin onto your create widget? I can’t seem to find the option to add extra pins.

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [December 28, 2017, 10:16am UTC](https://forums.unrealengine.com/t/how-can-i-store-a-series-of-text/412986/10 "2017-12-28T10:16:31Z")

</div>

You can expose variables in actors and widgets like so:

![225264-untitled.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/a/0/ca05b8a2c0ce8a3c7d510a8fb4ff9ec4283b0c57.png)

Alternatively, you can do this if you do not want to expose:

 ![225265-cap2.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/4/2/74204df07e17665724c39ccbd50fd1184faf12ac.png)

Or even this:

 ![225266-cap3.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/2/f/c2f4be07a85c9a853a392cfb338c674cea285fe2.png)

All three will do the same thing.

---

<div class="post-metadata">

**Author:** ![yuyake79](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@yuyake79](https://forums.unrealengine.com/u/yuyake79)\
**Post date:** [December 28, 2017, 10:54am UTC](https://forums.unrealengine.com/t/how-can-i-store-a-series-of-text/412986/11 "2017-12-28T10:54:42Z")

</div>

Wow, excellent. Thank you!
