How to create a column to reflect the current system date?

Steven Sun shared this question 56 days ago
Answered

Hi Team,

Any idea about how to set up one column to show the current system date is? And this column can be used for further calculation as a datetime data.

I've tried something in the attachment, but there is only 0 values and it's numeric instead of datetime which I need. Please kindly guide me. thanks.

Comments (15)

photo
1

Hi Steven,


This is possible, through a Calculated Field. It depends on your DBMS, as the syntax differs slightly between them. For example in MySQL, you could create a Freehand SQL Calculated Field with the value:


NOW()

that would print out the system time.


Let me know if that helps.


Kind regards,

Simon

photo
1

Hi Simon,

Thanks for the response!

I don't catch your point yet. It doesn't work if I put 'NOW()' in the calculated field.You mean I should add one free hand SQL column with NOW(), can guide me further? thanks.

photo
1

Pls refer to attached image

photo
1

Hi Steven,


The screenshot you've shown me is correct, however, the error is most likely due to the DBMS you are using. You should be able to google the query for system time in MSSQL, Oracle, MySQL or whatever you use.


Let me know if you still have difficulties.


Kind regards,

Simon

photo
1

Hi Simon,

I've tried getdate() because ours is MSSQL, system alert error, and I tried sysdate(), still the same.

Can you advise me? thanks.

photo
1

Hi Steven,


Those queries should work, including 'CURRENT_TIMESTAMP'. Are you able to send through your appserver/logs folder so that I can observe the error being thrown?


Kind regards,

Simon

photo
1

Hi Simon,

Please refer to my attached pic. Please help guide me how to including CURRENT_TIMESTAMP. Actually, I made one calculation but only got errors(also attached).

I'm trying to get appserver/logs, will provide soon.

photo
1

Hi Steven,


I've just tried this on my end and both GETDATE() and CURRENT_TIMESTAMP work as expected. If you could send through the appserver/logs folder, it looks like you might be experiencing a different kind of error.


Kind regards,

Simon

photo
1

Hi Simon,

I've contacted server admin to provide the log file, suppose we can get the log soon.

In the mean while, is the pre-defined function in calculated field an alternative? pls refer to attachment.

I chose current date + 0, however there are only 0 value after I drag this column into the report.

What I need is datetime data which can be used to calculate with other column of datetime.

Hope you can understand. thanks.

photo
1

Hi Steven,


This will not get the result you are after, as this is a metric value of the number of days difference, from the current date. This will give the result '0', because today is 0 days away from today.


Using Freehand SQL, GETDATE() and CURRENT_TIMESTAMP are the two best way to get the current server time. I will wait to see what your log files say.


Kind regards,

Simon

photo
1

Hi Simon,

I agree with you. let's focus on GETDATE and CURRENT_TIMESTAMP.

Before getting log file, I found this (in attachment) It's prepared by a colleague of mine. Hence I'm think if it's a authorization issue.

photo
1

Hi Steven,


Thanks for sending that through.


It's really hard to say what the issue is with only the screenshots provided. If you have the ability to make any changes in your environment, as you have a better understanding of what might be affecting it, then I would encourage you to go ahead, however, I won't be able to make any suggestions on my end until I see the logs.


Kind regards,

Simon

photo
1

Hi Simon,

Can you please provide more details about the log file, such as path file name etc.?

Our server team is hard to locate it only by appserver/logs.

Thanks

photo
1

Hi Steven,


The appserver/logs folder is generally found in the installation directory of your Yellowfin instance. This article explains where the files are that I am looking for.


Kind regards,

Simon

photo
1

Hi Simon,

Finally, I found it a authorization issue, I can have getdate() value after I've been granted for Admin access.

We can close this ticket now.

Thank you very much!