Send parameters to a function

Hello Survey Solutions Team,

Is it possible to send a parameter to a function just like the one in the random question example?

(new Func( () => {
$randomize[1];
})).Invoke()

for example, I’ll like to send the rowcode as a parameter.

Thanks in advance.

No, it is not possible. We do not support Function()…Invoke() statements in Survey Solutions. We do not recommend you to use it as we cannot guarantee the correct execution of such statements.

Hello Jose, if you describe your problem at hand we can try to come up with a solution that would not require such advanced machinery. Best, Sergiy

Thank you very much @misha and @sergiy for your answers, we were trying to consume information from an upper level of a nested roster without mapping the information with a variable inside every roster. But our objective can be achieved mapping it, we just wanted to be sure that it is the best an only way.

Attributes of the parent level should be immediately available for consumption in the child items where there is no collision.

For example, if you had a roster of MEMBERS and each member carried a roster of JOBS (assume for example that MEMBERS is triggered by a list and JOBS is fixed with main and secondary items). Then within each job validation you can refer e.g. to a person’s education or age attribute. This would be interpreted as the education (or age) of that person whose job we are talking about in this context. A common example:

job_tenure<(age-18)

where job_tenure is a job-level attribute, and age is a person-level attribute.

The collision will occur for system variables (@rowcode, @rowindex) which will be interpreted in the context where they are used. Hence to refer to @rowcode of the parent, define it as a calculated variable at the parent level

personcode=@rowcode

and refer to personcode in the expressions at the job-level.

The above we have discussed already, so I am not sure where exactly is the problem that you are trying to solve. Perhaps you mean something else by ‘mapping’.

Regards, Sergiy