How do specify a dynamic range selection in scripting

6.32K viewsScriptingcelsoft corporation scripting

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

tawanda Answered question July 7, 2019

Thank you very much, this is great!

tawanda Answered question July 7, 2019

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

S A U Answered question July 6, 2019

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 {
// Step 2. Renaming the last Item[11] to Item[1]
c.items[0].name = 1 // Done! 
// *******************************************************

S A U Answered question July 5, 2019

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.

tawanda Answered question July 4, 2019

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.

S A U Edited answer July 4, 2019

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

S A U Answered question July 3, 2019