Datagrid query filter for reference table

hi guys, i have just about got all the patterns figured out that i need, this one i can't quite get.

what i want to do is use a joining table between two DB tables as the reference point for the foreign key relationship.

then using the records in this table, i want to filter a datagrid and provide the results from the other table to the datagrid. the picture below explains it a bit better.

any advice on how to write this style of datagrid.load $filter ?

Hi @TMRGlobal,

You can't do that with filter. It is the equivalent of the WHERE SQL statement and not JOIN. You need to create a custom method which returns the desired result, or a stored procedure/ SQL view.

yeah the SQL is failry simple,

SELECT Y.* FROM TableY
INNER JOIN TableJoin ON TableJoin.TableYID = TableY.ID
WHERE TableJoin.TableXID = Parameters.Id

but if that's not possible, i'll look at a custom method for the above

hey @korchev i have tried a few things including using a lamda expression in the WHERE clause of the underlying mapped table, i feel i'm close to the solution but can't quite get it.

is the above SQL possible in the $filter expression or are you still of the opinion to do a custom data get ?

I think I already answered your question :slight_smile: My opinion hasn't changed.

thanks mate :smiley: much appreciated

Okay, i'm getting there,
i have followed the example as described --> Invoke custom method (Angular)
note the video is no longer available :frowning:

soo far i have created the following procedure in the server / controllers / XXXcontroller.custom.cs
however the code example callse for JSON on the return line, can you advise where this shuold be referenced from ?

I don't understand that. I suggest searching online for tips how to return JSON from a controller. This isn't something specific to Radzen.

thanks @korchev i don't understand it either :smiley: i have followed the instructions but i don't really understand what this JSON reference is. it's not newtonsoft or system.text.JSON to the best of my knowledge.

is there another dependency that is required?

Why don't you just search online?

because it's your example :smiley: seriously though i'll see what i can find

i might have found it, i was following the Angular example, not the blazor example.... i'll let myself out