I have two TCA fields as type DateTime.
Field1 and Field2.
A date and time is selected for field1.
The value of field 1 must automatically be in the Field2. (default value)
But the value for field 2 must be changed.
The date for the Field2 must be for next week on Wednesday.
**Example 1:**
Field1:05-04-2018 17:00
Field2 becomes: 05-09-2018 17:00
**Example 2:**
Field1:05-14-2018 12:00
Field2 becomes: 05-23-2018 12:00
Is that possible?
it might be easier to write an individual getter without an own field as the value can be computet from field1 directly.
then you might cache the value for the lifetime of the object. don't forget to clear the cache on a new setting of field1.
or you modify the setter of field1 to also compute and set the value of field2.
Related
I have a lookup table as follows:
StartDate
EndDate
Name
01/01/2022
31/01/2022
Custom Name 1
01/02/2022
28/02/2022
Custom Name 2
etc.
On another sheet I have a date column and a name column. I want to autopopulate the name from this lookup table based on the date being between one of the start and end dates.
What validation formula do I need to apply to get this to work?
I want to set a default date of 1900-01-01 on a nullable date field.
I've tried this
$table->date('fecha_nacimiento')->nullable()
->default(\Carbon\Carbon::make('1900-01-01')->toDateTimeString());
Also
$table->date('fecha_nacimiento')->nullable()
->default(\Carbon\Carbon::make('1900-01-01'));
Also
$table->date('fecha_nacimiento')->nullable()->default('1900-01-01');
When I save from the browser with the HTML date input not set, it saves the date field as null.
The default value on the field only applies when no value, not even null, is assigned.
The blank value is most likely from a blank input from a form. Also, if you are using eloquent mass assignment like so,
$model->fill($request->all());
In this case, your date field is set to null and your insert statement will look like this,
INSERT INTO table_name (fecha_nacimiento, ...)
VALUES (null, ...);
I have a report consisting of two parameters
Start_Date
End_Date
I want to write an expression in Ireport where the parameter Start_Date display first day of the year (2018-01-01) by default as parameter value
Example today's date 2018-10-18 I want the parameter Start_Date to have this default value as 2018-01-01
Is there any expression in Ireport which can display 2018-01-01 as default value. (First Day of Year)
Set the Default Value expression of your Start_Date parameter field to this:
"01.01." + java.util.Calendar.getInstance().get(Calendar.YEAR)
It sucessfully generated a report for me.
The same should work for your other parameter, e.g. with the last day of the year.
I'm trying to figure out how to configure a calculation field in Cognito Forms to display a timestamp when another field is filled out.
For example:
Name Field #1 = Bob
Timestamp Field #1 = Timestamp when "Bob" was entered into Name Field #1
Name Field #2 = Nancy
Timestamp Field #2 = Timestamp When "Nancy" was entered into Name Field #2
Name Field #3 = Null
Timestamp Field #3 = Null
When a user edits other parts of the form the timestamps will not update. Only when that specific field is updated, edited or revised should the timestamp associated with that field update.
I was told I would need to pass the timestamps as strings using a calculation field set to the text option but I don't understand how to stop these fields from updating every time the form is edited or submitted.
You would need to create two date fields: one for the date and the other for the time.
Set both to be either invisible or visible internally.
DateField1: Set the type to 'date' and default value = if NameField1 = null then null else DateTime.Today
TimeField1: Set the type to 'time' and default value = if NameField1 = null then null else DateTime.Now
Then create a calculation field. You can have it become visible when NameField1 != null
This calculation field will be your timestamp.
Timestamp1: DateField1.ToString("MM/dd/yyyy")+" at "+TimeField1.ToString("hh:mm tt")
I hope this helps
I've found that using any kind of date/time calculation in Cognito simply inputs the runtime date and time, so it's not a true timestamp. The only effective way is to have the user input the date and time. Unfortunately.
I need to add a integer field to the date field then output value should be in date format.
For Eg: frequency is integer field and certdate is date field i wrote a Set Value action in which I need to set the summation of both values to the Nextdate field(Date) and i am using db2.
If having a Value of :certdate + :frequency and a Parameter/Attribute of NEXTDATE isn't working for you, you'll need to revert to an automation script or Java class that uses the Date and Calendar classes to do what you want.