Syntax question

A very silly question, but I can´t find answer. If I want to retrieve a field from a resultset, but address it by a variable (so not by its real field name), how do I do that?

$w(‘#dataset1’).getCurrentItem().[variable]

Thanks.

Hi,
Can you please clarify what is the use case? What are you trying to achieve?

I already solved it, but thanks for your time. The solution was simple:

$w(’ #dataset1 ').getCurrentItem()[fieldname] , so without the dot, with the square brackets.