Hello James,
thanks for the link, having your panel was really useful.
I was able to get you an 'insert below' function working here is the code:
var newrecall = {
name: params.getValue("store_name",0),
Layout: params.getValue("Layout",0),
Abus: params.getValue("Abus",0),
Bbus: params.getValue("Bbus",0),
Key1: params.getValue("Key1",0),
Key2: params.getValue("Key2",0),
Key3: params.getValue("Key3",0),
Key4: params.getValue("Key4",0),
};
var allValuesArray = params.getAllValues("recalls");
var selectedRowIndex = params.getValue('selection', 0);
// Insertion is below the selected row
var insertionIndex = selectedRowIndex + 1;
// Array.slice includes first index, excludes last index.
var firstElementsArray = allValuesArray.slice(0, insertionIndex);
var lastElementsArray = allValuesArray.slice(insertionIndex);
// Add the new element to the list and concatenate them
firstElementsArray.push(newrecall);
var resultingArray = firstElementsArray.concat(lastElementsArray);
// Update the values of the table
params.setAllValues("recalls", resultingArray);
// Set the selected row as the one which was just inserted
params.setValue('selection', 0, insertionIndex);
The only drawback is that you cannot insert an element as the first one in the list, but with this example I think you can easily figure it out if you need to.
Regards,
------------------------------
Marc-André Parent
Ross Video
------------------------------
Original Message:
Sent: 08-21-2023 20:07
From: James Hessler
Subject: DashBoard Structured Parameter Table
Hey Marc-André,
I've replied directly to you with a link to the file.
Thanks,
James.
------------------------------
James Hessler
WAAY TV (ALLEN MEDIA BROADCASTING)
Original Message:
Sent: 08-17-2023 12:53
From: Marc-André Parent
Subject: DashBoard Structured Parameter Table
Hello James,
sorry for the late reply. Can you attache a copy of your current panel so I can have a look?
Best regards,
------------------------------
Marc-André Parent
Ross Video
Original Message:
Sent: 04-29-2023 15:48
From: James Hessler
Subject: DashBoard Structured Parameter Table
It occurs to me that since I also have wanted to duplicate an existing row in the table, maybe I could use a duplicate function to accomplish both goals.
I would have the selection that could determine where to add the new recall..with selection or index+1.
I do not know Javascript or ogScript, so I am just stabbing in the dark here.
I did try to make the add items and in one attempt, deleted the whole table---just like I feared, it all came crashing down.
Is this possible?
Thanks,
James.
------------------------------
James Hessler
WAAY (HEARTLAND MEDIA)
Original Message:
Sent: 04-27-2023 17:00
From: James Hessler
Subject: DashBoard Structured Parameter Table
I have built a table based on a tutorial by Ben Gatien on structured parameters
I'm using the playlist to drive sources to monitor arrays and split effects on our Carbonite Black.
This task adds a new item to the bottom of the playlist.
<task tasktype="ogscript">var newrecall = { name: params.getValue("store_name",0), Layout: params.getValue("Layout",0), Abus: params.getValue("Abus",0), Bbus: params.getValue("Bbus",0), Key1: params.getValue("Key1",0), Key2: params.getValue("Key2",0), Key3: params.getValue("Key3",0), Key4: params.getValue("Key4",0),};var count = params.getElementCount("recalls");var p = params.getParam("recalls",0);p.setValueAt(count, newrecall);</task>
For late changes, my directors are asking about adding a new item in a particular place.
I'm thinking that the "add new item" combined with elements of the "move up" function might get me close, but I am afraid it might also break every item below the insert point.
Move Up:
<task tasktype="ogscript">var newarray = new Array();var index = params.getValue("selection",0);if (index>0) { // Recreate the array of values, with a new order. var count = params.getElementCount("recalls"); for (var i=0; i < count; i++) { if (i == index-1) { newarray.push(params.getValue("recalls",index)); continue; } if (i == index) { newarray.push(params.getValue("recalls",index-1)); continue; } newarray.push(params.getValue("recalls",i)); } params.setAllValues("recalls", newarray); params.setValue("selection",0,index-1);}</task>
Does anybody have any ideas?
Can I do this without everything crumbling down around my ears?
Thanks,
James.
#DashBoard
#CarboniteBlack
------------------------------
James Hessler
WAAY (HEARTLAND MEDIA)
------------------------------