ClosedXML.Report icon indicating copy to clipboard operation
ClosedXML.Report copied to clipboard

null-propagation Errors

Open Platonenkov opened this issue 2 years ago • 6 comments

When I use in template {{np(User.Range, ""Not registred"")}} I get an error ')' or ',' expected User here is null. If I use {{np(User.Range, null)}} I get an error The 'np' (null-propagation) function requires the first argument to be a MemberExpression, ParameterExpression or MethodCallExpression

how to use np correctly?

Platonenkov avatar Jul 12 '22 09:07 Platonenkov

trying different options, came to this solution:

{{User == null ? "User error" : User.Range.ToString()}}

are there other ways?

Platonenkov avatar Jul 12 '22 10:07 Platonenkov

Hi. Try this {{np(User.Range, "Not registred")}}

b0bi79 avatar Jul 15 '22 19:07 b0bi79

Same

The 'np' (null-propagation) function requires the first argument to be a MemberExpression, ParameterExpression or MethodCallExpression

Platonenkov avatar Jul 16 '22 07:07 Platonenkov

Please provide a sample file and reproduction code for I could investigate the issue.

Pankraty avatar Jul 27 '23 21:07 Pankraty

Delete

dakidd88 avatar Oct 12 '23 14:10 dakidd88

Close project

dakidd88 avatar Oct 12 '23 14:10 dakidd88