How to get the table data based on index?

Hi Team,
I have a table, let us assume [Month name and month number]: example([jan:1];[feb:2][mar:3];[apr:4]… so on till [dec:12])
I would like to copy a value which satisfies a criteria.
Ex: if item equals to “apr” then it should return value 4 and copy that value in a variable.

Is this possible to do? if so please provide me the solution.

Thanks in advance.

Sure, you can use index to access the value in a particular cell

You can read about using indexes here: https://kb.workfusion.com/display/RPAe/Recorder+Variables#RecorderVariables-UsingIndexeswithLists

Thank you so much Ashapkina. I will try this.

1 Like

If you have a table and not a list then you can use the following Custom Script to access:

@CustomScriptAction(
    input = ['data_table','row_pointer','col_pointer'],
    output = 'cell_value'
)
 
def customScript() {
     def cell_value = data_table.get(row_pointer,col_pointer) 
}

You just need to define data_table, row_pointer,col_pointer and cell_value as usual then they can be used in the script. Then set the row_pointer and col_pointer to point at whatever data in the matrix you require.

Very flexible and fast retrival from a table.

1 Like

It is also possible to use method get() in other actions in the Recorder to get the value of a particular cell in a table:

Constant value:

Enter keystrokes:

Hi ashapkina
Is there any way to get the index of an list stored in recorder variable?i have tried using get size but it does not work.

Is it possible to get?if so please provide me the solution.

thanks in advance.

@shrimathi can you provide more details about your use case?
Do you need to get the total number of elements in the list?

Actually i want to perform some operations like copy paste for the files in the folder.
For this i have used get content to get all the files from the folder and used (win+r) command to open the every file and iterated using for each loop and stored the file directory in recorder variable.In this for the first file alone i need to copy the column name and for the remaining files i dont want to copy the column name.This column name must be copied only once (i.e) for the first file in the directory.

For this purpose i thought of getting the index of an first file and can put in if condition.

@ashapkina i am trying to get the index of an list element

@shrimathi how do you define which file is the first? Is it the oldest file?