How do specify a dynamic range selection in scripting

Generic selectors
Exact matches only
Search title only
Search in content
Search in all posts
Search in pages
Answers
Questions
0

How can I modify this script to do a dynamic range selection:
def itemSize = |HC Casual Labour Budget Input::’2′..Row|
I want to replace the ‘2’ in the first line to something that means the second item of a category Row no matter what the name of the second item is. I wish I could do something like:
def itemSize = |HC Casual Labour Budget Input::Row[FIRST+1]..Row|   so that it always selects from second row to the last row of the specified Row category.
Any help please

Answered question
0

Thank you very much, this is great!

Answered question
0

Addition two. Here’s how a-script DeletionItems works:

Answered question
0

For manipulations with the structure of the matrix (not with the values) it is easier to use cycles (loops). If you need to remove from the category all its items except the first one, use this a-script:
/*********************************************************
DeletionItems is A-script to delete all Items from D category but the first one
**********************************************************/
c = |Matrix2::D|
// Step 1. Deleting Items [0 .. 10] from D category
(0..<(c.items.size – 1)).each {
……c.items[0].delete()
}
// Step 2. Renaming the last Item[11] to Item[1]
c.items[0].name = 1 // Done! 
// *******************************************************

Answered question
0

Thank you for the response. However I did not understand your solution. I have therefore attached a model with the script I am trying to improve. Kindly modify my script so that where I quote a 2 in creating a range to delete, I do not hard-code the number.

Answered question
0

Addition. Mentioned above method of sample the column’s values except the first value.
Here’s how this works:
*

*
As it can be seen from aniGIF, the column number is passed to the a-script. Then the a-script from the column with this number returns all its values except the first one.

Edited answer
0

Hi,
Let 2D matrix ‘HC Casual Labour Budget Input‘ has:
– one category at the QM’s column tray with index 0 and
– one category at the QM’s row tray with index 1 (in you case this is Row category).
*
To extract column’s values excluding the first one it is possible to use this code pointing on column’s index [0; sizeColumnCategory – 1]:
*
def itemSize = |HC Casual Labour Budget Input|.categories[0].items[0].values.tail(),
// where items[0] is the first column.
*
Good luck

Answered question

Latest Questions