Display info on the listen server widget from the client widget. Array and Struct issue?

I am making a very small LAN cooking game and i’ve run into an issue with order tracking via struct and arrays.
Here’s the setup and what i am trying to do: The listen server has a widget that will contain and display all the orders that are coming in from the clients, then i want the listen server to be able to click on those orders and populate a new widget or container in the existing one that shows the details of the order, ingredients, dish name etc.
The way i am doing it now i have a text array called “Cart” and every time the client adds an item i add the name of that into the array, i use this “Cart” array on a ForEachLoop to populate the order, then another text array called “Ingredients” gets populated on the same time and adds the predefined ingredients to it and i pass that to the listen server to display a button wrapped container. It works as it should up to this point. Now when i click the order from the listen server i try to display what the order contains to a new window, if the order contains only 1 item it shows it correctly, if it has multiple i get the correct “item” names but all of the orders share the same ingredients instead of each show their individual ones. I am guessing the reason being is that the “ingredient” Array gets updated on the listen server when the order is sent in, therefor has the value of the latest item in it. I am completely stuck at this and tried various things but none of them seem to have worked. I’ve tried using a struct to store those variables but i arrived to the same problem. I hope this makes sense to someone can give me some insight. Thank you so much in advance.

Perhaps consider coupling the ingredients to the order with a specific key.

Sort of likebhow you have foreign keys in relational databases

So you send order with id 1 to the server. Later on you send ingredients and set their id to the order id (you can wrap this in a struct) the you can have a map on the server which would use the order id as a key and order struct as the value.
Inside the order struct you would nest the ingredients struct.

You can of course track down the link between order and ingredients by the order id.

The order id would probably be assigned via the listen server when the client starts his ordering process so that they are all unique.

I am afraid i dont know how to do that, if its not too much too ask could give me a little more detail as to how to achieve that? Thanks for replying!

I’ll try to make a prototype

Thank you so much, i really appreciate the trouble you’re going in to help!

I suggest using a new JsonBlueprintUtilities plugin in this case.

image

It allows you to use dynamic structures.

  1. Pack Order:

  1. Unpack Order:

I hope it’ll be helpful to you.

My Products

Thanks! ill give it a go and let you know. One little follow up, the struct you have made contains 3 string variables? 1 for dish 1 for customer and 1 string array for the ingredients?

I made an example structure using three variables.
You can create any structure you want.

I tried it and i get the same results i was getting before, the ingredients just get replaced. I upload a very small video showing the issue

2023-01-13 18-43-49.mkv (1.8 MB)

cooking.zip (1.8 MB)

One of the structs may need a recompile (I think it was ingredient)

It’s pretty bare bones, but you can at least see the underlying mechanism.
If you want custom client ingredients then just change the ingredients array before sending it to the server.

This was insanely helpful, thanks so much!