mat-datepicker changes date inconsistently - mat-datepicker

Problem: I select 2/28/2022 using the calendar drop down. I then change the date, keying over 28 and make it 31.
Expectations: 2/32/2022 is not valid and should be flagged as an error. Instead the date is changed to 3/3/2022. If i enter 2/33/2022 it is flagged as an error. The behavior is unexpected and inconsistent.

Related

How do I execute the CTRL + H function in a Microsoft Access query automatically?

I have numbers displayed as Ranges Ex. 3-7 Days or 24-72 Hours. I need to change these to just a number like 168 or 72 so I can ultimately do comparisons or if statements. I know i can just click CTRL H and go through each condition to format the data, but I have been trying to find a way to have this happen through the query. I am very new to Access so I may be thinking about this all wrong. I tried typing this Expr1: Replace("0-4 Hours", "0-4 Hours", "4") in the field and sometimes it asks for a parameter but it just creates a column called Expr1 with the parameter in it. I followed the syntax i found on this site for replace function so i must be way off.
Query is looking for a field named 0-4 Hours which of course it can't find, hence the prompt (which should always happen, not just sometimes so that is a mystery). Correct syntax:
Expr1: Replace([fieldname], "0-4 Hours", "4").
However, this calc result will show only for records that have 0-4 Hours value. Dynamically calculating this for every record should be possible with:
SELECT *, Val(Mid([fieldname], InStr([fieldname], "-")+1)) As Num FROM tablename;
Every record must have value because Null will cause error.
If the unit (Days, Hours, etc) is not same for all records, this gets even more complicated. If Days and Hours are the only units involved and you want to convert all to Hours:
Val(Mid([fieldname], InStr([fieldname], "-")+1)) * IIf(InStr([fieldname],"Days")>0,24,1) As Num
Any more complication and a VBA custom function would likely be required.

Google data studio Date range - Add upcoming event

Is it any possibility to select all values based on date range which is >= date which selected in data studio? Or this is still not supported.
P.S. Any other way to get an upcoming event, like if currently 8th of October, it will display which event(holiday) will be next?
The way I've achieved this in reports is to have a dimension that reflects whether the event is in the future, "Future"/"Past".
I've then filtered the table by this dimension so it only shows future events and then changed the Default Date Range to "All Date Range".
The table will now show all future events.

Using #Prompt in sql using SAP BO WEBI 4.2 SP3

I'm running a series of reports where time window called in query is rolling, and individual per report.. Some reports look 400 days back, others look 10 weeks back, while others again look at -40days/+80days... and so on - many options.
All reports are scheduled in daily or weekly runs, meaning setting prompts will require a manual reset of prompt for every instance through the scheduler. Not optimal.
I know the universe designer can design specific filters to drag into the queries using the query designer, but with so many different options, I find it a bit of an issue that the universe designer should create specific filters for these specific purposes, adding a vast number of specific filters intended for specific use to various universes.
I'm after an option where it is possible to assign a calculation to a date field, which stay fixed for the purpose of the report for every scheduled instance.
For instance, looking at invoice date from 400 days before today and onwards would look like Where DIM_TIME_INV.DAY_DAY >= sysdate -400 - This I can hardcode into the SQl of the specific report, and it will stay through the scheduler and roll 1 day for every day the report is run. But if I decide to make a change in the query elements, the SQl is screwed, and I will have to manually add the modification to the SQL again.
I found an article reg. the use of #Prompt and would ask universe designer to try and sandbox this in our version of BO.
While I'm being impatient, I try myself using following code based on example 4 from linked article.
SELECT
#select('DIM_TIME_INV.DAY_DAY') >= sysdate -(#prompt('Invoiced, days before today:','N',[DIM_TIME_INV.DAY_DAY],mono,free))
FROM
DIM_TIME_INV
Testing the SQL gives following error:
ORA-00936
SAP kba 2054721
The whole idea is to have a flexible yet consistent dimension that will calculate every time the report is run, without losing the code whenever new items are added to the report.
Does anyone know of a way to use the #Prompt in SQL for SAP WEBI 4.2? - Or any other way to have 'flexible' time dimensions where it is possible to set a from-date or to-date independently or even a range, without having universe designer creating a s**t-load of filters and dump in various universes.
Thanks // C
With regard to your example code, I think you're on the right track but your syntax has some issues:
SELECT
#select('DIM_TIME_INV.DAY_DAY') >= sysdate -(#prompt('Invoiced, days before today:','N',[DIM_TIME_INV.DAY_DAY],mono,free))
FROM
DIM_TIME_INV
First, both #Select and #Prompt must refer to universe objects, not columns. The syntax for both is: class name\object name. Assuming that the DIM_TIME_INV.DAY_DAY is associated with a universe object named Day Day in a class named Dim Time, the above code should be:
SELECT
#select('Dim Time\Day Day') >= sysdate -(#prompt('Invoiced, days before today:','N','Dim Time\Day Day',mono,free))
FROM
DIM_TIME_INV
Also note that the object reference in the #prompt call is delimited by single quotes, not brackets.
Next, I'm assuming that DAY_DAY is a date field. Its reference in the #prompt call would cause the prompt to display a list of values, sourced from DAY_DAY. But you want a numeric value from the prompt, not a date, so I would just leave that out, which will let the users enter a numeric value:
SELECT
#select('Dim Time\Day Day') >= sysdate -(#prompt('Invoiced, days before today:','N',,mono,free))
FROM
DIM_TIME_INV
Next, even with this corrected syntax, there will be an issue using this code as you have it. A good way to debug #prompt issues is to view the SQL in the WebI report after you get the error -- the SQL will show the rendered result, with all functions (#select and #prompt) expanded. For the above, you might get SQL like:
SELECT
DIM_TIME_INV.DAY_DAY >= sysdate -(400)
FROM
DIM_TIME_INV
This, of course, is invalid - you can't have a condition in the SELECT clause. If this is truly intended to be a condition (which I think it is, based on your objective), then it should be a predefined condition rather than a dimension.
With that said, I think you're on the right track for what you want to do. With the above corrections, you would have a predefined condition that you could drop into reports, which would enable the users to select the starting period (by number of days ago) for the report. You could create additional prompts with different logic, ex:
#select('Dim Time\Day Day') >= sysdate -(#prompt('Invoiced, weeks before today:','N',,mono,free) * 7)
or
#select('Dim Time\Day Day')
BETWEEN sysdate - #prompt('Starting days ago:','N',,mono,free)
AND sysdate - #prompt('Ending days ago:','N',,mono,free)

Access 2013: How to Return All Records With Date Older than X?

My Problem
I have a date field in the table in question. I'm trying to create a query that will only display records where that date field are 120 days old or older.
My Code
Solution Attempt 1
The first solution I tried was simply added criteria to my date field. The criteria formula I used was:
< Date()-120
This removed a few 'random' records leaving me with 714 of my original 905 records. Unfortunately, a quick look through the dates of remaining records in ascending order, it was obvious that I was still getting records more recent that 120 days old.
Based on my 'random' result above, I double checked the format of my field by changing the field to:
DATE: Format([myDtField], "mm/dd/yyyy")
I ran the query again - this reduced the number of records removed, leaving me with 734 of 905 - but my issue persisted - I still had records with dates more recent than 120 old.
Solution Attempt 2
Based on my issues above, I decided to go a different route. This time I created a unique field for my criteria calculation. For the field value I used:
DateDiff: DateDiff("d",[myDtField],Date())
This resulted in values that were very far off from the correct values (ex. a record with a date of yesterday resulted in 43!).
Solution Attempt 3
This was less of a solution and more just troubleshooting, but based on the results I'm getting, I keep thinking my dates aren't being perceived by the system as the date it's displaying (i.e. DateValue() is off compared to displayed value). I spot checked a few of the dates vs their DateValue() and the randomly selected records all seemed to be correct. So again, no luck.
Solution Attempt 4
#Gustov reminded me about the DateValue() function. I've attempted that on the field as well - the field is imported as a text field, thus needs converted to a date value. Similar to the formula Gustov posted, for my field value I used:
DATEDIFF: DateDiff("d",Nz(DateValue([LASTPAYDT]),0),Date())
And then in the criteria I simply used the formula:
>120
This results in the following error:
Data type mismatch in criteria expression
This was probably the closest solution I had, simply because WITHOUT criteria it returns the proper values (i.e. a date of yesterday returned "1", while a date of two days ago returned "2"... etc). So you would think simply limiting records where this field is >120 would work, but then it throws up the error above.
My Question
Does anyone have an idea of how to check if a record field is 120
days old or older?
If either of my above solutions works for question 1, then what might be wrong with my date field that is causing issues if I am going about it the right way?
#Gustov's DateValue() solution is close (i.e. provides the correct values), but adding criteria causes an error. Any solutions?
I'm at a loss. An extra set of eyes on this problem would be greatly appreciated. Thanks!
Hans touches something. If the dates are not dates but text, try this:
Select * From YourTable
Where
IsDate([myDtField])
And
DateDiff("d", DateValue([myDtField]), Date()) > 120
I have tried this and it works, DATAText is the data stored as a text.
SELECT Tabella1.ID, Tabella1.DATAText, Date() AS Espr1
FROM Tabella1
WHERE (cDate(Format(Tabella1.DataText,"yyyy-MM-dd hh:mm:ss")))<Date()-120;

Using DATEPART for AM works correctly but does not work for PM query

I'm using a query to pull a report for our 3rd shift folks.
The issue I just noticed when the report was mailed with 0 results is that I have it set right now to run from 6pm to 5:59am the next morning. Since I have the date field = the GETDATE, it doesn't see the results from the night prior(1800-2359). I was thinking of having this just pull from like -12 hours, but the button can be pressed at anytime to look at results.
So if they pushed it before the end of the shift, it would show some of 1st shifts entries. I want it to only run from 1800-0559 the next morning, no matter if the button is pressed before midnight or after midnight. I hope this makes sense. I'm not even sure if the between recognizes to go to 00 after it's hit 2359. I have this built into a VB.net application, and they can press the button anytime they want to get results. This is for management to track what is being done as the employees are required to enter data real time when issues are taking place.
Thanks for any help. Hope I made enough sense! :D
SELECT
Assignment, Datemodified, General,
IncNumber, NextSteps, PDCRStatus,
RootCause, Status, Summary,
Timings, UserID
FROM
Turnover
WHERE DATEPART(HOUR, datemodified) between 18 and 05
AND CONVERT(NVARCHAR(50),datemodified,103) = CONVERT(NVARCHAR(50),GETDATE(),103);
I guess when you are checking for a particular time range, the date is changing over the time i.e., 1800 hrs of a day to 0500 hrs of the next.
I see that your query is checking for only the time, but date is not considered.
I guess if you can check for the date as well as time together, it should work.
As of now I do not have sql server on my machine, else would have helped you with a sample query.
Cheers,
Hope it helps!
i'm assuming you want all the data starting from yesterday 18:00.
SELECT
Assignment, Datemodified, General,
IncNumber, NextSteps, PDCRStatus,
RootCause, Status, Summary,
Timings, UserID
FROM
Turnover
WHERE datemodified >= dateadd(HH,-6,convert(datetime,convert(date,GETDATE())))
i'm getting the current datetime with getdate and extract the day. when converting it back to a datetime i have 00:00, so i subtract 6 hours with dateadd and hence select yesterday 18:00. however i do not know how this is supposed to behave at certain hours. it will always go to yesterday 18:00, which means when you start it at 23:59, you will see an interval of 29 hours 59 minutes. when started at 00:00, you will see 6 hours.