Fill a variable with a selected field in a table

Hi everyone!

I was wondering if there is a way to fill a variable with the content of a selected cell of a table.

I'm woking on a formulary that shows a table as a result. This table has X lines and 7 columms. I want to make something to be able to get the value of one of those cells, specific the cell that the user selected, and fill a numeric variable with that value.

Is it possible or am I asking too much? :)

BOS 6.1.1

Thanks in advance and a great weekend for everyone.

 

Hi Rafael 

I have done this with BOS 5.10.1 , i dont know if in 6.1.1 version there are better things

You can do it , you store in a Map variable all the information of your table, in a Map <Integer, List<Integer,String>> way

In a BOS table you just can get the first value by the field_YourTableName.get(0), in this first columns you store the id of your register, which is the same of the id of your Map

 

And with this you can get by id and/ or position your information.

 

Hope this help you

 

Regards

 

Hi michailrmd,

Well, I'm not a great groovy developer but I'll defintely try your tip. Thanks!

Any chance you have your old code? Taking a look at it may help. :)

I solved it easily. :)

The table must have the property 'Allow selection - Single'.

First, I've set the columnm I wanted to a list variable ('data' option in the table properties).

Then I've made an operation to get the first (and only) value of this list into my variable:

def variable = list.first()

return variable

Easy! If my explanation is kinda poor, just answer this thread and I can explain with images if necessary. :)