Grid default value not working

Sorry to mix 2 things up here but for the symlink topic:
I already create my symlink with a bat-file, but sadly it doesn't seem to 'lock' :frowning:

cd "C:\dev\Manager\client"
RD /S /Q "C:\dev\Manager\client\node_modules"
cd "C:\Program Files\Sysinternals"
junction.exe "C:\dev\Manager\client\node_modules" "C:\Program Files\Radzen\resources\node_modules"

Yes, creating the symlink won't always work as Radzen will delete it after you stop the application. Still it will prevent Visual Studio from running npm install. I will retract my suggestion.

I have a feeling that the filter not working however is probably not related to that.

Yes, I think you are right. I retested it and it is still there, my fault.

${event.filter} and EventID eq '${selectedEvent.EventID}'

This will not work initially if ${event.filter} is empty. You can use the Query Builder to set the filter so you can both use the user specified filtering and the predefined condition.

As far as I can see my code is exactly like the one in the query-builder on this example page.
This is written in the query-builder on the documentation:

This is my version:

${event.filter} and EventID eq '${selectedEvent.EventID}'

'selectedEvent' is nothing else than a page-property in form of an object.

I do not get where I can distinguish between the definition of the filter which ...
... defines how to filter down all the data in the sql-table (eg. only events from a certain 1-n relation)
... defines a prefilter in the datagrid

${event.filter} is empty by default hence ${event.filter} and EventID eq '${selectedEvent.EventID}' leads to an invalid expression. You will have to do something as in this forum post: ${event.filter ? event.filter + ' and ' : ''} EventID eq '${selectedEvent.EventID}.

The Query Builder handles that out of the box so you don't have to write complex expressions.

1 Like

Thank you for the explanation, but now I have even more questions.
In which case a user might want to NOT use the filter which he/she can define in the designer?
How about you add predefined filters to the query as a default.
If there is really a case in which somebody does not want that feature to work (how? why? who? ... it's a grid) it would be easier to put a checkbox for that somewhere.
You could use your solution: ${event.filter ? event.filter + ' and ' : ''}
Default event.filter to true if it's empty: (${event.filter}) and ("")
This would be a solution which would totally work with all the designer-code your users would have used until today. I mean you are presenting easy tutorial-screenshots on your documentation page which suggest to leave this i-would-assume-very-useful-feature hanging.

EDIT: Actually I do not understand why adding event.filter to the query is even required, it could be done automatically, which would make it much more readable.

The Invoke data source method can be called in other places that are not event handlers (or from event handlers of components that do not support filtering). This is why we do not include event.filter by default.

Ok, how about putting it as a default value in the query-builder?
When the user adds the parameter named $filter
This could be done for the $top with too
$skip -> event.skip
$orderby -> ${event.orderby}
$count -> != null && event.skip != null

This is all stuff which I always add with the same values.
They would be still interchangeable by the users, so no "automagical" stuff happens, only default values when the user decides to add them from the ui.

We can probably do that. However it will still not fix the issue you have described in this post because of this.

${event.filter ? event.filter + ' and ' : ''}
Isn't working either :frowning:

What is the complete value of the $filter parameter? If it is just that - yes it is invalid.

${event.filter ? event.filter + ' and ' : ''} EventID eq '${selectedEvent.EventID}'

The expression looks correct. Is there any JavaScript or server-side error (you can check Radzen's Output pane for the latter)? What is the type of the EventID property?

Unfortunately not. But since the last update I inferred the db again and a boolean which was nullable before is now just a boolean. This leads to the grid showing no values anymore (in this column). I can still edit and save the boolean in the edit-mask, before it showed true/false strings in this column.
I am just posting this part to be sure 'HasOrder eq false' is the right way to test for a boolean.

The type of the EventID property is really a string.

I know there was no test for a boolean value in the string I provided 2 posts ago so yes this wasn't the complete result of my querystring.

The whole query would be this:

${event.filter ? event.filter + ' and ' : ''} EventID eq '${this.selectedEvent.EventID}' and HasOrder eq ${!!this.checkboxOrdersOnly.value}

which evaluates in the debugger like this:

" EventID eq 'SWB2018' and HasOrder eq false"

The reason for checking the HasOrder condition not being in the provided string was that my test for the HasOrder boolean value has nothing to do with the actual boolean value which should be queried in the event.filter.

So just to be sure that I got that right:
If I set a FilterValue of 0 for a boolean column in my datagrid this will be included in my event.filter?

There was indeed an issue with nullable columns which we have fixed.

EventID eq 'SWB2018' and HasOrder eq false looks as a correct filter expression. The only thing I am not 100% sure about is the space it starts with. It is worth trying this just to be on the safe side (no whitespace before EventID):

${event.filter ? event.filter + ' and ' : ''}EventID eq '${this.selectedEvent.EventID}' and HasOrder eq ${!!this.checkboxOrdersOnly.value}

If I set a FilterValue of 0 for a boolean column in my datagrid this will be included in my event.filter?

No. FilterValue is just setting the filtering UI of the DataGrid. The ${event.filter} wont be affected in any way.

I removed the space at the start, doesn't seem to make a difference.
But adding a check for the boolean column ends in the grid never loading data.
My querystring looks like this now

${event.filter ? event.filter + ' and ' : ''}EventID eq '${this.selectedEvent.EventID}' and IsTest eq ${this.selectedEvent.IsTest}

it evaluates to this

"EventID eq 'SWB2018' and IsTest eq false"

this is my columns configuration:

The query is valid. Can you confirm that it returns any values when run as SQL? There are two cases when the grid would remain empty:

  1. Empty result is returned
  2. The query has failed

You can check for the first by inspecting the server response in your browser's developer tools.

The second would cause a server-side exception that is logged in Radzen's Output window.

Yes I can confirm that it returns data. But the grid does not remain empty, it never loads. And I cleared my radzen output window, refreshed the page and couldn't find any 'ODataException' in it. The browsers console stays empty too.

As soon as I want to test for the boolean 'IsTest' value the endless loading is in place, without any exception.

${event.filter ? event.filter : 'IsTest eq false'} and EventID eq '${this.selectedEvent.EventID}'

I just deleted and auto-regenerated the columns and realized I had a typo in the column-name (we had some db-changes on our side), so in the end my query failed but still, I didn't get an exception. But was my fault for sure for not rechecking the column names. :frowning: