Restrict future date selection in adaptive forms AEM - forms

I want to restrict future date selection in AEM adaptive forms.
Also if there is any way to restrict date selection unto any particular date (any future or past date)

You can configure the Minimum Value and the Maximum Value for the date field to prevent the user from selecting a date which is outside this range. However, there are certain restrictions
The values mentioned above cannot be dynamic and would be a fixed value. Hence, you cannot set them to something like today or now. It has to be a value in the ISO format which is yyyy-mm-dd.
As long as you have not specified a display pattern (i.e., you are using the default value of the field), it would bring up the browser's native date picker which disables the dates outside your minimum and maximum range. However, if you set a display format, then AEM's datepicker would be displayed and it doesn't disabled dates outside the min-max specified.
That being said, you can still write a validation rule which throws an error if the value selected/entered is outside the valid date range or if it is greater than today (depending on what you want to validate).
Open the rule editor.
Click on Create rule.
Select Validate by clicking on the dropdown arrow beside the When (which is the default)
In the Using Expression section, select your date field for the First Object, select is before for the operator and select Function Output > Get Current Date for the second object.
The final rule should look as shown below

Related

Tableau - Filter/Parameter For Different Date Ranges

I am trying to set up a filter or parameter for different date ranges in Tableau, such as:
Previous Week
Previous 4-Weeks
Previous 8-Weeks
based on the most recent data in the database. Is this possible?
Edit:
I should have been more clear here.
Is it possible to only have these options in the filter and have it based on the maximum date in the database?
Update
Based on your comment and updated question, you can do it as you intend, though it isn't as straight-forward.
NOTE: I did this very quickly and with a random data set, so it will be important for you to test this thoroughly with your data set.
Steps:
Create a parameter control that the users will use to change the selected date range. I created this as a list of strings with values that I can use directly in a calculated (after simple casting):
Create a calculated field that you will use as a filter that references the selection of the parameter control. It tests to see if the difference (in weeks) between the maximum date in the view and the date of any given row is less than the value of the parameter.
Calculation: INT([Date Filter Parameter]) > DATEDIFF("week",ATTR([Date Field]),WINDOW_MAX(MAX([Date Field])))
Place the calculated field in the filter box and set it to True.
You will be able to filter your data like so:
Original Answer
Yup - that is built into Tableau.
Add your date to the filter and select the "Relative Date" option:
You can set the defaults - users can change these later:
Then just "Show Filter":

Create a calendar to pick dates (and time) in Jasper server

enter image description here
#jtsnr --This snapshot from jasper server.I clicked outside the text box Dateto and a calendar is displayed. But there is no calendar icon outside the boxes as seen in previous example. Also, the text box takes any text typed into it but throws error that type a valid date.If date is typed it accepts it.I want it should accept only dates picked from calendar or typed dates only. Is that possible?
When you create the input control in JasperServer via the wizard you need to select a Type of Date at the Set the Datatype Kind and Properties stage.

ms access autofill date field based on date of previous record

I have a table that has estimate numbers for each department on a given date (each date is a record with fields EST_DATE, DEPT1, DEPT2, DEPT3, etc.). The date is the indexed primary key (no duplicates).
When a user creates a new record I would like the date to autofill based on the last record.
So if the last estimate was for 07/02/2015, the date for the new record should autofill as 07/03/2015. Using a default value based on the current date won't work because these estimates are generated days or weeks in advance. If it matters, the format for field EST_DATE is set to "mm/dd/yyyy".
I would prefer to use the default value of the EST_DATE field itself, but I can also use event-based VBA since users will normally be entering this estimate data via a bound form.
Create a hidden textbox named, say, MaxEstDate.
Set it's ControlSource to: =Max([EST_DATE]).
Set the DefaultValue of the textbox with EST_DATE to: =[MaxEstDate].

Excel - Insert "day" on a cell and format it to date with current month and year

I am working on a home accounting template (and could not find any good one :-/), so I am creating one for each month. Both in my expenses and my incomes, I would like to have a date column where I just have to insert the "day" (e.g.: 22) and it automatically fills the rest with the current month and year (or I could set them in another cell).
For example: 22 + ENTER would return: 22/12/2014
If I do this, I automatically get a default date: 22/01/1900
I do not know if it is possible to change this defaul date depending on the current one or any other value.
I have tried with a different strategy: if the amount column is not empty, fill in with today's date: =IF(A3="";"";TODAY())
The problem is that I do not always register today's expenses, so I need to change it manually. I was just wondering if this is possible and there is a better way (maybe a macro?).
You need Excel to modify the cell contents after you press ENTER. The only option seems to be a Macro using the Worksheet_Change event.
Please check out this other question. I think that will help.
This can be achieved with simple formatting and use of controls that are available in Excel. VBA will give you drastically more flexibility, however the request above can be accomplished without learning VBA.
I have included a sample file here.
Steps to recreate:
Create a range of months. I created a range including the current month through 12/2014
Insert a combo box from the developer tab. Right click and select Format Control. On the Control tab, input the range you just created and then select a "linked cell". This will insert an integer to indicate which item you picked in the list, starting at 1.
Use the attached formula to add the DAY that you enter in the first column and VLOOKUP the month and year from the value chosen in the combo box.
Enhancements: I used conditional formatting to change the text color of the days you enter to WHITE. This way you won't see them. I also included some checking in the VLOOKUP formula: the day you enter must be a number and must be non-blank for a date to populate.

Drupal 7: Filter view if date field has end date

I have the following situation in Drupal 7: I have a content type "documents" which contains a field validity which is a Date field that is mandatory. It may contain an end date, but it also may not. (Single Date field that allows setting an end date.)
The meaning of this field is that if the end date is set, the document is valid only until this end date (which may be in the past or the future). If there is no end date set, the document is valid until further notice.
Now I want to create a view that filters all documents which are still valid. So the first filter I create is that the field_validity value is in the past. Now I need a filter that checks if either the end date is not set or is in the future. But in the database, the end date is set to the same date as the starting date, when it is not selected in the specific entity.
Any ideas how I can archive this?
Regards,
Christoph
Have you tried a PHP views filter? https://drupal.org/project/views_php
It allows you to create a Views filter which executes custom PHP code, so you can have full control over your condition.
The module only exists in a DEV version, but is widely used with 38,000 active installations.
Otherwise, if I understand correctly, you only want to show documents that are between field_validity and end date.
One option would be to problematically set your end date to something obscene (100 years later), if the value is blank. This way your view will be simple to create.