Script to update values for specific items

236 viewsScripting

Hi Everyone,

I’m trying to update the values on specific items using a script and haven’t found the right combination to use. In the screenshot I want the outcome of the script to input a 1 in Filter anytime the dept item contains “Total Dept”.

Thanks for looking!

if (|matrix2|.getSelection(it, |matrix2::dept|).value.contains("Total Dept"))
it.value = 1()

Gilbert Answered question June 24, 2024

Hi jeffc,

A value in the script above refers to the value of an item in the cell. Here you should use name of an item because, as I see from your matrix, you would like to refer to the item’s name, and check if it contains specific text. Please see below the script you are looking for.


myItems = |Matrix55::dept|.items

int categorySize = |Matrix55::dept|.items.size()

for (j=0;j<categorySize;j++)  {

if (myItems[j].name.contains("Total dept"))

myItems[j].value = 1
jeffc Posted new comment June 25, 2024

Thank you Tahir this worked!

You are viewing 1 out of 3 answers, click here to view all answers.