Adding to a date

Questions related to using nuBuilder Forte.

Adding to a date

Postby ALW » Wed Jun 12, 2019 12:01 am

Hi there,

I've just started using nubuilder (which I'm loving so far!) and as a test case I'm building a simple database that keeps records of equipment and when it was last calibrated. Most fields are either typed by the user or lookups from other tables and that's all working a treat.

I want a column in the form that displays the calibration due date, which would be the calibration date field + 2 years. I initially set this up as a calc field in the initial form (so I have a database field allocated to it), but realised it isn't possible to do calculations on date fields, so I've hit a brick wall currently on how to achieve this.

Can anyone point me in the right direction please?

Thanks,

Andy.
ALW
 
Posts: 2
Joined: Tue Jun 11, 2019 11:51 pm

Re: Adding to a date

Postby Alohajoe5 » Wed Jun 12, 2019 1:11 am

Andy,

Have you considered adding a field like Calculated_Date and using a DATE_ADD() function? The arguments DATE_ADD() accepts are listed here:

https://www.w3schools.com/sql/func_mysql_date_add.asp

Then, you could simply display that field.
Alohajoe5
 
Posts: 55
Joined: Tue Apr 16, 2019 9:02 pm

Re: Adding to a date

Postby ALW » Wed Jun 12, 2019 7:32 pm

Have you considered adding a field like Calculated_Date and using a DATE_ADD() function?


Thank you!

I don't know why I didn't think of this, as I'd already used CONCAT in another field to combine multiple values, but my SQL is rusty and this was just the trigger I needed!
ALW
 
Posts: 2
Joined: Tue Jun 11, 2019 11:51 pm

Re: Adding to a date

Postby admin » Sun Jun 16, 2019 7:26 am

.
admin
Site Admin
 
Posts: 3124
Joined: Mon Jun 15, 2009 9:53 am


Return to General