Search String Parameter

I want to use the indexOf function to search a string parameter (does it need to be an array?) to find the string position equal to the string name searched. And then use that variable to recall the position of the clip.

Example being, if I had a clip called breaking_news and it was the 7th item listed var i would = 7 after the search and then the task would recall that number from var i.

I know I’m not putting in something correctly and apologizes for my terrible coding.

var i = params.getIndexof(List, 0)

rosstalk.sendMessage(‘100.121. 85.37’, 9993, ‘goto: clip id: i’);

indexOf only works on String objects. There is no ‘indexOf’ in the params object.

In the code above, it looks like you may get better use out of using an INT parameter with an INT_CHOICE constraint. Then, the value of the parameter would be the same as the index of the selected item.

Clip 1 Clip 2 Clip 3 Clip 4 ogscript.debug('SELECTED INDEX: ' + params.getValue('Clip_IDs', 0)); Otherwise, you could write a utility function to get the constraint (list of choices) and find out which one is selected: Clip 1 Clip 2 Clip 3 Clip 4 function indexOfSelection(oid) { var param = params.getParam(oid, 0); var choices = param.getConstraint().getChoices(); var value = param.getValue(); for (var i = 0; i < choices.length; i++) { if (value == choices[i]) { return i; } }

return -1;
}
ogscript.debug('SELECTED INDEX: ’ + indexOfSelection(‘Clip_IDs’));

#DashBoard

Sorry for the delayed response, I’ve been trying to get a better understanding of how this works. I’ve gotten the list to populate and I can search the constraints, but what I think I need to search is the constraint key. Here is a (much) shorter version of the parameter list:

01_SetHFin Desk 02_SetHFin BN Desk 03_SetHFin BN Today 04_SetHFin Today 05_SetHFin News Now The problem I run into is we have multiple sources that would have the same items but in different places. I want to compare the constraint key to a predetermined value such as 04_SetHFin Today and then set the parameter to that constraint value when found. Is there a way to query that?

#DashBoard