How filter datagrid column by int list

I have this custom method
public IActionResult getEmbassyByUser(string user_id)
{
var embassy = baicDb.UserEmbassies.Where(c => c.user_id == user_id).Select(c => c.embassy_id).ToList();
//var embassy = [1,2];
return Json(new { embassy });
}
That returns an int list.
I want to filter datagrid with this lis but I can´t. Is there another solution.

My configuration in radzen is like this:

Y save that value like this: ${usr_embassy} = ${result.embassy}
After invoque my custom method that returns the list.

I'll apreciate your help. Regards.
Patricia Neira

Hi @Patricia_Neira,

The format is:

If you have array variable you can do this:

Hi @enchev, thank you

I already did the configuration you show me. But is not working :frowning:
The data grid stays loading.

Before load the grid I assign a list value to the variable with a custom method:

Then assigned the return value to the variable in Radzen:
${usr_embassy} = ${result.embassy}

And I have the same configuration as you told me

Can you please help me?
Regards

Most probably there is an error, you can check it using your browser console network tab.

This is the console tab:
http://localhost:5000/odata/BaicDB/CarAssignations?$filter=embassy%20in%20(1,2)&$top=10&$skip=0&$count=true&$expand=Car1,Embassy1 500 (Internal Server Error)

And in radzen console I get this:
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware[1]
An unhandled exception has occurred while executing the request.
System.ArgumentException: Expression of type 'System.Collections.Generic.List1[System.Nullable1[System.Int32]]' cannot be used for parameter of type 'System.Collections.Generic.IEnumerable1[System.Int32]' of method 'Boolean Contains[Int32](System.Collections.Generic.IEnumerable1[System.Int32], Int32)'
Parameter name: arg0
at System.Dynamic.Utils.ExpressionUtils.ValidateOneArgument(MethodBase method, ExpressionType nodeKind, Expression arguments, ParameterInfo pi, String methodParamName, String argumentParamName, Int32 index)
at System.Linq.Expressions.Expression.Call(Expression instance, MethodInfo method, Expression arg0, Expression arg1)

But I don't understand why, I tried as your example, without variable:

Hi @Patricia_Neira,

I’ve just noticed that you are using custom server method instead data-source invoke - my approach with query builder will not work in this case. You can add second parameter to the server method and pass the value as normal parameter. If you hold Radzen license you can send us your project at info@radzen.com to check what's going on.