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.
Related
I am creating an SSRS report the will be filtered by a date parameter. However, i want to have an option for that Date parameter will be used to filter by Posting Date or Delivery Date
A parameter for the DATE_TYPE needs to be created with the Posting or Delivery as the available values.
If you want to do the filter in SQL, you would add something like:
WHERE 1 = 1
AND <CURRENT CRITERIA>
AND (POSTING_DATE = #DATE OR #DATE_TYPE <> 'Posting') --the parenthesis are VERY important here
AND (DELIVERY_DATE = #DATE OR #DATE_TYPE <> 'Delivery')
If the Date Type Parameter = Posting, the Posting Date must be the #DATE parameter. If it's not Posting then the second part of the OR will be True. Then it does a similar check on the Delivery Date field.
It's a little more complicated in the FILTER tab of SSRS's tables, charts or datasets.
In the Filter tab, add a new filter. Choose the Posting Date field as the Expression, date as the type and = as the operator. For the Value, press the Function button [Fx] to open the expression window. Your expression would be something like
=IIF(Parameters!DATE_TYPE.Value = "Posting", Parameters!DATE.Value, Fields!POSTING_DATE.Value)
The do the same for the Delivery date field.
This will compare the Posting date field to the date parameter if the DATE_TYPE is Posting. Otherwise it will compare the Posting date field to the Posting date field which will always be true when DATE_TYPE is NOT Posting.
When I select the date 16-01-2021, this value comes to my input field. But when I look at the value received by the service, I get the value "{15.01.2021 21:00:00}". how can i fix this?
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 microservice and I use REST methods such as GET PUT POST, for this issue lets take an example POST !
I want to add a record to one table, but I need to only add two values and the remaining two are id and date. ID is auto increment and have used Sequence Generator, hence working even if I do not give an ID as input.
I would like to do the same for Date but would like to not input date plus make sure the date set for that record is the SYS Date in the Oracle DB, I have made Date variable default as SYSDate in DB but its still not taking in a null value as its not null. How do I implement this ?
Help is truly appreciated !
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.