Hey trying to create some buttons using some information from my data table the problem is i don’t want to create a button for every instance in my datatable since alot of them have the same category so i just want to get the category’s out. Is there a way to check if its the same wording and if so skip it? And maybe also count it so it knows how many had that category?
The way im doing it i get over 100 buttons where each 20 that is the same category gets a button each. i just want the 5 buttons 1 for each category.
you could create a array and add the category to the array once a button has been created for it. then each time you would possibly create a new button you check to see if the category is in the array. you would have to be pretty careful when populating the datatable so you don’t have errors, so i would probably use a enumeration for each category.
Note you may need to use the add unique node instead of add.
you can do the same thing with text as long as the text is a exact match for each category, for example if you had a category sports it couldn’t be Sports, sport, soprts since the three don’t match. i suggest a enumeration since then you only have to type it once, then when you enter your values in the table its a dropdown.
to create a enumeration you right click the content browser then go to blueprints and select enumeration, its basically just a list. then you would need to add the enumeration to the struct that your currently using for your datatable, so open the struct and set the category type to the enum you created.
you would want to check the array prior to creating the widget. what your doing currently is creating a widget but never adding it to the screen until after the check. the widget still exists though so it may be taking a little performance away. instead move the create widget to somewhere after the branch node, then it will only be created if its needed.