How to refer to an item which is within a nested roster

Dear Team,

The unit question for an item is within a nested roster and I want to filter the unit according to the item selected outside the nested roster.

In that can How can i define a macro since I will have to repeat that filter for each item.

When I tried to write this macro it cannot refer to the rowcode since the item code is outside the nested roster.
macor name:unitfilter
unit_filter_final.Values.Any(x
=> (decimal)x.unit_code == @optioncode
&& (decimal)x.code == @rowcode)

Code which is the item code is outside the roster and for each item we ask whether its home produced to purchased and for each home produced tor purchase we ask the unit and quantity. Now how can i call the macro $unitfilter using the code outside the roster.

@tsheringcee , in the outside roster you can define a calculated variable:

x=@rowcode

then refer to this new variable x in the nested roster conditions where you need a rowcode of the parent roster.

Best, Sergiy

I am getting this error Sergiy. Can you help me

I defined the macro this way

unit_filter_final.Values.Any(x
=> (decimal)x.unit_code == @optioncode
&& (decimal)x.code == f.@rowcode)