How to set date range for #Consumption.filter.defaultValue? - sapui5

I'm using the ABAP Restful Application Programming Model - oData v2.
I'd like to be able to default in a date range of say, a CreationDate within the last 3 months.
At a very basic level, I can default in a single arbitrary date, see my CDS View below...
#Consumption.filter.defaultValue: '20201012000000'
CreationDate : rap_cp_odata_v2_edm_datetime ;
Could you please provide an example of how a date range could be set up using Today's date going back 3 months rather than having to provide a literal value?

Add this against Date field -
#Consumption.filter.selectionType: #INTERVAL

Related

Flutter - How to sort a list of DateTime objects according to week ranges

I have a list of dateTime objects that I would like to sort according to the week ranges of the corresponding year.
How can I determine the week range (start date & end date) for each DateTime object?
Please find attached a screenshot that I have added to showcase what I am trying to accomplish.
Without sharing actual code it's hard to pinpoint, but as a suggestion, I suggest taking mod of those dates based on by converting millisecondsSinceEpoch value.

Azure Data Factory - Date Expression in component 'derived column' for last 7 Days

I am very new to Azure Data Factory. I have created a simple Pipeline using the same source and target table. The pipeline is supposed to take the date column from the source table, apply an expression to the column date (datatype date as shown in the schema below) in the source table, and it is supposed to either load 1 if the date is within the last 7 days or 0 otherwise in the column last_7_days (as in schema).
The schema for both source and target tables look like this:
Now, I am facing a challenge to write an expression in the component DerivedColumn. I have managed to find out the date which is 7 days ago with the expression: .
In summary, the idea is to load last_7_days column in target Table with value '1' if date >= current date - interval 7 day and date <= current date like in SQL.I would be very grateful, if anyone could help me with any tips and suggestions. If you require further information, please let me know.
Just for more information: source/target table column date is static with 10 years of date from 2020 till 2030 in yyyy-mm-dd format. ETL should run everyday and only put value 1 to the last 7 days: column last_7_days looking back from current date. Other entries must recieve value 0.
You currently use the expression bellow:
case ( date == currentDate(),1, date >= subDays(currentDate(),7),1, date <subDays(currentDate(),7,0, date > currentDate(),0)
If we were you, we will also choose case() function to build the expression.
About you question in comment, I'm afraid no, there isn't an another elegant way for. To achieve our request, Data Flow expression can be complex. It may be comprised with many functions. case() function is the best one for you.
It's very clear and easy to understand.

Quicksight datepicker for month only

I'm searching for a way to have month selection and that will serve as startdate and enddate for the date filtering.
I'm building a monthly report on quicksight, I try to use the last 31 days but that give information of multiple months
I already create date picker for those parameters but didn't find any way to limit the value to be the complete month only.
Example : if select the 12 september I desire to get the September values only (from the 1er to the 31th)
Any advice is welcome
Thanks for your help
First, add a new date filter (if you want, e.g., today to be the default you'll need to add a dynamic default against a data set that returns today)
Add a new control (I found naming this to be difficult, perhaps you're better at picking names than I am)
Add a new calculated field that returns 1 if the truncDate of your date field and the truncDate of your parameter are equal, otherwise return 0
ifelse(
truncDate("MM", {date}) = truncDate("MM", ${InMonth}),
1,
0
)
Finally, add a filter that checks where your calculated field is 1 and apply it to all visuals

IBM i (AS400/ISeries) - Adding days to date field in WRKQRY

I have a decimal date field (TDDATR) that is in the YYYYMMDD format.
I would like to create a field that is TDDATR + 30 days but I am unable to.
Using 'Define Results Field' I have tried a few things;
Simply doing this;
TDDATR + 30 DAYS
But it returned this error: Labeled duration not used correctly.
I tried using the DIGITS and SUBSTR commands to create a field in the DDMMYYYY format and then +30 days but got the same error.
Same as above but in the DD/MM/YYYY format - same error.
Using DATE(TDDATR) but all I see is +'s in the field.
Using DATE( ) on the fields created in step 2 and 3 - still get +'s
I've ran out of ideas - any help would be greatly appreciated.
Query/400 lacks a lot of the features that an SQL based interface has.
I'd urge you to consider switching to Query Manager (STRQM) which is a fully SQL based product. You can even convert Query/400 queries to Query Manager queries with the RTVQMQRY command by having the ALWQRYDFN parm set to *YES.
The other option that IBM is pushing is Web Query. Again, fully SQL based and you can convert Query/400 queries into it.
Having said that, the problem is that FLD + 30 DAYS only works when FLD is a DATE data type. Query/400 includes a DATE() function to convert non-date types into date. But it's very limited in that it only works with character fields formatted according to your job defaults. Assuming you're in the US, it'd only work with a character value of '07/01/15'.
You could do a lot of manipulation in Query/400 and end up with a result field that meets DATE()'s requirements. But a better solution would be to create an SQL view over your table and have your numeric date converted into a date data type in the view.
You can find code examples that show how to convert a numeric YYYYMMDD to a actual date data type in the view. However, I'd recommend create a user defined function (UDF) that will do the conversion for you. That will make it much easier to use in the view and to reuse in other places.
If you'd like, there's an open source package called iDate, that includes all the code required for convert to/from date data types.
Download that, install/compile it and your SQL view becomes
select ... idate(TDDATR,'*CCYMD') as TD_DATE
from myfile
The use of days is as follow
Field Expression
CURDATE_30 days(current(date)) + 30
The solution to your problem is: given the field A dec(8,0)
Field Expression
YYYYMMDD_ date(substr(digits(a),5,2)||'/'||
substr(digits(a),7,2)||'/'||
substr(digits(a),3,2))
NEXT_MONTH DAYS(YYYYMMDD_) + 30
Remember to check the date format in your job description. In the example the format is MDY or MM/DD/YY.
More info here
Based on the information here, I created the below 2 fields;
TDDIGI DIGITS(TDDATR)
TDDAT1 SUBSTR(TDDIGI,7,2)||'/'||
SUBSTR(TDDIGI,5,2)||'/'||
SUBSTR(TDDIGI,3,2)
From here I was able to create a date field;
TDDAT2 DATE(TDDAT1)
Which allowed me to perform the necessary calculations.
The format of TDDAT1 is based on your job description which can be found by;
WRKJOB
Option 2
Page down
Date format..: X
Mine was *DMY, so TDDAT1 was formatted based on this.

Drupal 7 and Page Manager: add Selection rules based on dates

I have a content type article with a field date.
I am trying to fire a variant from Page Manager by defining a selection rule based on a date field.
What I am trying to do is applying this variant when
the node type is article
field date, start date < now < field date, end date
I can define the first condition but I can't figure out how to make a condition based on a date. Is it possible or not? I couldn't find more information about this.
Thanks
I managed to do this finally by writing a PHP Code Selection Rule.
I got from the exposed $contexts variable the start and end values for date field and I wrote a simple condition to check if "now" is in between the two dates.
Beware that the dates are stored in UTC format in the field and your site/users might be in a different timezone.