I have been using my dashboard for over a month and there is some feature creep fast approaching (self inflicted I might add)
I want to use a date picker that uses the input as a variable that I can feed back into the end point of the script where my SQL statements live. I am making a page with a date picker that populates a table and graph, and I found this rather handy piece of code:
Hi @psDevUK, I seem to have hit a few snags so far, do you think you could help with some silly questions?
I have installed the UniversalDashboardUDDatePicker with the following command:
Install-Module UniversalDashboard.UDDatePicker
When I run the test script from the Project’s Page I get the following error when I select 2 dates (Look at the bottom right of my screenshot): "An unexpected error occured invoking 'ClientEvent' on the server. CmdletInvocationException: AuthorizationManager check failed"
Hello @kreef no worries for asking the questions, and no question is a silly question as it will end up helping someone else out with that same question in the future…
I just seen this ping up as I was replying to another post…sadly I need to do some house things right now…but with any component I build I try and give as much help as possible…as I put the component out there… so have you read:- https://psdevuk.github.io/ud-flix/Custom-Date-Picker/ which is the blog I wrote for this?
I will post a working example later with comments but I really need to go help my wife and kids, else I will be in trouble… will update this post later, but let me know how you get on with the blog read and if makes more sense after that. Peace
Unfortunately I still can’t seem to get this working, I Tried the other calendar and I also get the same Toast error message when I click to submit a date: "An unexpected error occured invoking 'ClientEvent' on the server. CmdletInvocationException: AuthorizationManager check failed"
I wonder if it isn’t something wrong with my installation then?
I run this component on a work dashboard so I know it works…and had others users use this ok…do you have a locked down powershell execution policy? Can you install latest community edition on vm or pc/laptop and see if you can get module working with that? I use loads of my custom component on my dashboard. Can you try another random component off of the marketplace see if you get same issue
So I have been experimenting and everything seems to work just fine, but I can’t get the dashboard to accept the dates that I choose.
My thinking was that I just use the start and end variables in my SQL statement, but for some reason it doesn’t populate my chart. If it’s not too much of a cheeky request you by any chance have an example where you use the date picker with SQL?
Hey @kreef must be in different time zones, as I am running late for work…more than happy to provide a fully working SQL example, but will have to wait till I finish work, or on my lunch break…I did do a blog on how I use SQL in UD located here:- https://psdevuk.github.io/ud-flix/Serving-SQL-on-a-UniversalDashboard/
Also just for clarity my SQL DB I search on I have to provide the date format in yyyy-mm-dd as in
Select something
,somethingElse
From dbo.this.DB
WHERE datecolumn BETWEEN '2019-01-01' AND '2019-01-16'
Hey @kreef finished work and back home now…so you need to read the blog on how I am using SQL with UD…I couldn’t post whole script due to sensitivity but this is it, minus the New-UDSelector bit I had to strip out…FOCUS on the $Session:Start and $Session:End as that is how the SQL dates are being past, after being formatted correctly. I do not claim this is the best way or smartest, but it works for me and give me the results I need everytime:-
The code is not complete and does not have all the corresponding closing brackets…but hopefully this is enough to show you how to get the date selector working with SQL…on my blog I do mention how to do charts so please look at that as well. Peace