Toolbox plugin (Expression) doesn't return value in repeating group

I am using the Expression (from Toolbox plugin) in a repeating group. The Expression does some calculations with the cell’s data. I assume that the code is correct - the console.log prints out the correct return values. But the plugin itself doesn’t return any value. No errors in the browser console and in the debugger.

What could be the reason?
I suspect that this plugin is not just intended to work inside the cell in the repeating group. But the correct values from the console.log puzzles me.

It surely isn’t a privacy rule issue since data is loaded in the console after all. Not sure but there’s a couple of challenges if you want to deal with data inside repeating groups. But then again, you’ve mentioned that you were able to get the data you need from the cells so you certainly don’t need some external plugins like orchestra right?

Could you expound more?

Here are a couple of screenshots with the comments.

Some random questions that floated past …

Can you show the full script in Expression?
Does it work on its own outside the RG?
What settings are on the RG, i.e. rows, columns, display all, etc.
Is the RG being scrolled?
Where is the Expression value being used?

The value returned is the overall script’s evaluated “completion value” which can be surprising, for example

let a=2;
// completion value is undefined
let a=2; a;
// completion value is 2

Thank you for responding. Here is a 3 min overview of the issue.

It seems I might missing something simple. I would be grateful for any hint.

You’re in luck, it is simple!

The last couple of lines of the script are two statements:

funcA(params); // completion value 47
console.log(funcA(params)); // completion value empty

So I think you’ll get the return value of the funcA if you put it at the last line.

Thanks for the video, very helpful.

Wow, it works! Thanks a lot - you really helped me.

But why the order of the lines is that important? Is this a specific of the plugin that the return value statement must be the last line?

It is often the last line, but not always.

Consider this script:

1 Like