Original Message:
Sent: 11-13-2024 10:35
From: James Peltzer
Subject: Copy just 3 columns and just 6 rows from 1 struct table to another struct table
Hi David
params.valueToJson(myTeam) will transform "myTeam" from DashBoard's internal parameter value representation into a JavaScript object (or array of objects) that you can more-easily manipulate.
------------------------------
James Peltzer
Ross Video
Original Message:
Sent: 11-13-2024 10:00
From: David Levy
Subject: Copy just 3 columns and just 6 rows from 1 struct table to another struct table
I tried params.getAllValues(), but it returns a Java object and I had to resort to using Java to actually get the data from the array. However, you've warned me that Java code isn't really supported, so I guess I will stick to getValue. Is there a plan to make getAllValues return something I can manipulate with ogscript?
function getAthletes(team, rotationOrder, scoreField) { var myTeam = params.getAllValues('team' + team + '.roster'); var newTeam = []; var rotOrder = 'rotationOrder' + rotationOrder; for (var i = 0; i < myTeam.length; i++) { var ro = myTeam[i].get(rotOrder); if (ro == "0") { continue; } else { var thisAthlete = { rotationOrder: ro, id: myTeam[i].get("id"), fullName: myTeam[i].get("fullName"), score: myTeam[i].get(scoreField) }; newTeam.push(thisAthlete); } } return newTeam; }
------------------------------
David Levy
Lead Real Time Graphics Developer
ESPN
Charlotte United States
Original Message:
Sent: 11-08-2024 15:59
From: James Peltzer
Subject: Copy just 3 columns and just 6 rows from 1 struct table to another struct table
Since you're looking to filter the data/copy a subset of rows and columns, using params.getValue() is probably about as good as you're going to get. One efficiency you could get is to build an array of JSON objects containing the values you want to put into your destination struct and use params.setAllValues instead of setting each element as you go.
------------------------------
James Peltzer
Ross Video
Original Message:
Sent: 11-07-2024 12:33
From: David Levy
Subject: Copy just 3 columns and just 6 rows from 1 struct table to another struct table
I'm storing a lot of data in dashboard about a lot of athletes.
However, at any given time, I only want to send a limited amount of that data.
So, for instance, I only want to send the event order, full name, and score of just 6 athletes who are currently competing in the vault.
I have a huge param of the whole roster of 25+ athletes, and there are columns that are irrelevant.
My intuition is to make a param that's visible to dashboard, and copy just those 6 athletes, and just those 3 columns.
Is that a good workflow? If so, what's an efficient way to make that copy?
Is it just a loop of "params.getValue" or is there a built-in function that's more efficient?
------------------------------
David Levy
Lead Real Time Graphics Developer
ESPN
Charlotte United States
------------------------------