System.Linq.Dynamic.Core
System.Linq.Dynamic.Core copied to clipboard
Exception while parsing expression ')' or ',' expected
--Exception while parsing expression (RuleContextInputTag.ProductOrder.ProductOrderItem.Any(ProductOrderItem=>ProductOrderItem.ProductOffering.Name=="Testing Value"&&ProductOrderItem._ProductOrderItem.Any(_ProductOrderItem=>_ProductOrderItem.ProductOffering.Name=="Testing Value")))
- ')' or ',' expected
Hello guys. This error is driving me insane, I can't seem to figure out what is wrong about this expression. Can someone help me please? :)
Hello @David-Moreira, Your code example is difficult to read, can you please provide a full C# exaple?
Sorry for not replying... Been quite busy. I ended up figuring out the problem.
Apparently when accessing using LINQ on a List within a List, if we use the same name for the LINQ accessor(_ProductOrderItem.Any(_ProductOrderItem=>) as the List Property this happens.
It is of note, that both ProductOrderItem and _ProductOrderItem are Lists of the same TYPE.
I'm not sure if that is to be expected. I will provide an example when I have the time.
Problem:
(RuleContextInputTag.ProductOrder.ProductOrderItem.Any(ProductOrderItem=>ProductOrderItem.ProductOffering.Name=="Testing Value"&&ProductOrderItem._ProductOrderItem.Any(_ProductOrderItem=>_ProductOrderItem.ProductOffering.Name=="Testing Value")))
Solution:
(RuleContextInputTag.ProductOrder.ProductOrderItem.Any(x=>x.ProductOffering.Name=="Testing Value"&&x._ProductOrderItem.Any(y=>y.ProductOffering.Name=="Testing Value")))
Hello, @StefH If you'd be so kind to take a look, here's the full c# example: https://github.com/David-Moreira/ListWithinList
@StefH Had any time to take a look at this yet?
@David-Moreira not yet in detail. Sorry.
Alright, thanks!
Hello @StefH I know you're probably busy with other stuff, and this issue isn't really that critical, but just a friendly reminder, if you can squeeze a tiny bit of time to take a look at this!! Appreciated, Thanks!
@David-Moreira I promise I'll take a look at your example code and debug the error.
However, I think that solving this issue needs some refactoring internally on the way the identifiers are saved.
I see. Thanks once again @StefH
Registering my interest in this : )
This is affecting another package I am using Microsoft Rules Engine
Hello, @StefH If you'd be so kind to take a look, here's the full c# example: https://github.com/David-Moreira/ListWithinList
This Repo is no longer available it seems, I would love to begin investigating how I can work around this. Is it deleted or just private? if the latter, could you allow me access ❤️
Hello, @StefH If you'd be so kind to take a look, here's the full c# example: https://github.com/David-Moreira/ListWithinList
This Repo is no longer available it seems, I would love to begin investigating how I can work around this. Is it deleted or just private? if the latter, could you allow me access ❤️
Hello sebastian. It's deleted. If I remember correctly I was able to work around this somehow. But that project is long gone so I don't have the details with me anymore. If my memory serves me right, I managed to somehow work around it by using the it functionality that's specific to dynamic linq and represents the item in the current lambda.
The docs over here are really good: https://dynamic-linq.net/expression-language