x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How can I enter data into a Data Table that is based on a struct, which has another struct data type for a variable?

Hi everybody,

I'm working on a weapon system for a game I'm working on and have run into a bit of a roadblock. What I'm attempting to do is use a data table to house my items for quick data management using CSV files. I have a Stats struct that I'm using to house a number of the combat related pieces of information on the weapons. In the table, this struct ends up being a struct reference variable and when looking in the table, it is displaying each of the variables of that sub struct as one single clump.

I want to be able to create a CSV and drop each value in. Does this mean I'll have to group a bunch of them together or is there a method that doesn't suck to work with that I can use to enter the data cleanly and have it imported?

What I have so far is these 2 Structs:alt textalt text

And I've created these 2 Data Tables. The problem comes with the "Stats" variable in the Main table. I created a second table from the second struct while trying to figure things out so I've included that as a "What the hell." type of bonus.alt textalt text

Any help would be greatly appreciated! And thanks ahead of time to anyone who looks at this and takes a crack at it.

Product Version: UE 4.22
Tags:
more ▼

asked Jun 15 '19 at 10:45 PM in Blueprint Scripting

avatar image

SithHunter
95 8 10 12

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Does this mean I'll have to group a bunch of them together or is there a method that doesn't suck to work with that I can use to enter the data cleanly and have it imported?

Depends on what you consider clean / sucky.

alt text

The Z column above is a material struct that is a part of another struct - that would be the equivalent of your Stats. I created an empty Data Table, added a single row and exported it as CSV - this shows me how the formatting should look like for a nested struct.

As you can see, it spits out quite a bit of gibberish. Luckily this can be cleaned up, I did it for the the Opacity, Colour and Glow. This has to be done only once and once you have a clean line with correct formatting, it can be duplicated freely, populated cleanly-ish with the desired data and reloaded back into the Data Table. It is still a clump but I found it quite manageable.


In case you want to store arrays of structs inside another struct, avoid CVS. Go for *.jsons - way more manageable.


Also, there are some changes heading Data Table ways, some really needed QoL improvements, like copy-pasting rows.

capture.png (24.4 kB)
more ▼

answered Jun 15 '19 at 11:28 PM

avatar image

Everynone
15.2k 77 25 62

avatar image SithHunter Jun 15 '19 at 11:34 PM

That's pretty much what I thought I'd have to do. I really appreciate the confirmation man!

Also, with regard to the importing file type, what would be the benefit of going from a csv to a json?

avatar image Everynone Jun 15 '19 at 11:56 PM

I meant arrays specifically, there's no clean-up needed and formatting is all neat and vertical. There used to be horrible mix ups with enumerators in csv, it may no longer be the case, though.

Array indexes in json:

alt text

vs

Array indexes in csv:

alt text

Export your Data Table as json, open it and see if you like what you find and what will make it easier to work with.


The same nested material struct in json for comparison:

alt text

json.png (13.5 kB)
csv.png (38.0 kB)
cap2.png (13.4 kB)
avatar image Everynone Jun 16 '19 at 12:06 AM

There's more to it, of course - web requests, more info here:

http://www.wraiyth.com/?p=198

avatar image SithHunter Jun 16 '19 at 12:16 AM

Daaaaamn. I didn't realize how much "cleaner" it is working with jsons. Huge thanks for the info and the resources!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question