Substructure assigning error

I have the following assign:

When I select the User.id I get the error:

Internal Error

Compilation Error.

Actions.ActionDebtCollectionDossierComment_List.cs(74,67): error CS0103: The name 'ssENUser' does not exist in the current context

target.ssComment.ssAuthor = new STSTR_USERStructure(null){ ssId = ssENUser.ssId };

State: Second stage compilation

Rank: #361

Hi Freek,

can you present us the flow as well? to see where User.Id should be defined.

Regards Hans

Rank: #469

Hi Hans,

The User table is joined in the query

Rank: #469

The problem is I think a list is being mapped to a sub level.

Rank: #469

Only solution I know is to do it like this but it's not the fix:

Rank: #239


You are probably very correct with this "list being mapped to sub level" idea. Here's an explanation from Microsoft for your error: https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-messages/cs0103

From this, I'm inclined to think that when OutSystems generates .NET code from this piece of yours, inner assign (author) does not have access to the scope where aggregate results are defined and outer record (comment) is assigned. As this mapping is done directly in assignment properties, aggregate results and your target structure/record are probably passed in to some internal mapping function. I've bumped to this same issue where sub-item mapping causes a compilation error, because something in code generation is incorrectly handled and results are not available in sub-assign/mapping.

Using temporary (action/screen) variables will move this sub-assignment one level up (or to a common scope) and therefore the second solution you posted works.

It's "just" a code generator after all.