Login
Register
Search
Home
Forums
Jobs
LawsonGuru
LawsonGuru Letter
LawsonGuru Blog
Worthwhile Reading
Infor Lawson News Feed
Store
Store FAQs
About
Forums
Performance Management
Smart Notification
Display numeric as time
Home
Forums
Jobs
LawsonGuru
LawsonGuru Letter
LawsonGuru Blog
Worthwhile Reading
Infor Lawson News Feed
Store
Store FAQs
About
Who's On?
Membership:
Latest:
Wayne
Past 24 Hours:
1
Prev. 24 Hours:
1
Overall:
5121
People Online:
Visitors:
289
Members:
0
Total:
289
Online Now:
New Topics
S3 Systems Administration
Using MFA for Lawson S3 Access
5/8/2024 1:23 PM
Does anyone use Multi Factor Authentication when u
Lawson Landmark
Executing IPA from PR160
5/3/2024 2:46 PM
We're facing a situation where we need to upda
IPA/ProcessFlow
Executing IPA from PR160
5/3/2024 2:46 PM
We're facing a situation where we need to upda
S3 Customization/Development
Cobol - Extract Current Time
4/24/2024 7:21 PM
How do you extract just the Current System Time in
Lawson Landmark
LPL INSTR Functions
4/5/2024 8:32 PM
I'm writing a simple report using the Create R
Infor SCM
Translating 856 to get the ~ REF^CN^ field
4/3/2024 8:24 PM
We are trying to get the tracking number which is
IPA/ProcessFlow
Sample XML file create Flow
4/3/2024 3:43 PM
Hello everyone, I am new to creating XML files
Lawson S3 HR/Payroll/Benefits
bn105 error message
3/26/2024 6:40 PM
I need to change some of the set ups in our Life I
IPA/ProcessFlow
IPA executing Job
3/13/2024 7:08 PM
New to the IPA world and was wondering, can an IPA
Lawson S3 HR/Payroll/Benefits
Life Age Reduction on benefits plans
3/12/2024 7:15 PM
For our optional life we have an age based coverag
Top Forum Posters
Name
Points
Greg Moeller
4184
David Williams
3349
JonA
3288
Kat V
2984
Woozy
1973
Jimmy Chiu
1883
Kwane McNeal
1437
Ragu Raghavan
1354
Roger French
1311
mark.cook
1244
Forums
Unanswered
Active Topics
Most Liked
Most Replies
Search Forums
Search
Advanced Search
Topics
Posts
Prev
Next
Forums
Smart Notification
Display numeric as time
Sort:
Oldest First
Most Recent First
You are not authorized to post a reply.
Author
Messages
thummel1
Veteran Member
Posts: 121
5/26/2015 4:53 PM
I am working on a smart note. There are 2 numeric columns designed to display in/out punches that will eventually come over in the Smart Note. One column has 'in' punches and the other has 'out' punches. When the table was designed, these columns were not formatted like hh:mm. They were formatted as numbers, no decimals. So the 'in' punch will look like 701 and the 'out' punch will look like 1150 (example).
Question: The end user wants to view these numbers like hh:mm. I am trying to think of creative ways to do that.
Idea 1: convert numeric to hh:mm, but everything I look up doesn't support this particular type of translation
Idea 2: formula to add a colon two digits to the left. I think thi swoudl work but just not sure how to construct the formula?
If you have any suggestions formulas you can direct me to that would be great. Thank you!
The.Sam.Groves
Veteran Member
Posts: 89
5/26/2015 6:18 PM
Assuming you are using Oracle SQL for the smart note:
to_char(to_date(to_char(your_timestamp, '0000'),'HH24MI'),'HH24:MI')
This converts the numeric to a four digit right zero padded string and then converts that back to a datetime value. It then reconverts the datetime back into a character string in 24 hour format with a : between the hour and the minutes.
I'm making assumptions that your SQL environment doesn't have a built in time only datatype (for instance Oracle has a timestamp datatype, however it is actually a datetime value with added precision on the seconds) if you did, you might be able to cut out the outer to_char and let SQL format the output on it's own.
But lacking that, if you attempted to run the above without manually specifying the format to use for the output, you'd get something more along the lines of '01-May-15' without any reference to a time.
thummel1
Veteran Member
Posts: 121
5/26/2015 7:06 PM
Thank you for your reply. I've inserted this formula into the statement. I've tried the following iterations:
TO_CHAR(to_date(TO_CHAR(ZZTMEDTTRN.IN_PUNCH, '0000'), 'HH24MI'), 'HH24:MI') -Error: ORA-01722: invalid number
TO_CHAR(to_date(TO_CHAR(.IN_PUNCH, '0000'), 'HH24MI'), 'HH24:MI') -Error: ORA-01722: invalid number
to_date(TO_CHAR(ZZTMEDTTRN.IN_PUNCH, '0000'), 'HH24MI'), 'HH24:MI') -Error: ORA-00932: inconsistent datatypes: expected NUMBER got DATE
Not sure where to go with these errors, any thoughts are welcome.
Another thought....If this is a numeric field as my table suggests, what about dividing by 100 and then replacing the decimal with a colon?
Again, not sure how to construct that, but it was another thought I had. I could do those things in Access or Crystal, but I'm not as versed in SQL Developer.
The.Sam.Groves
Veteran Member
Posts: 89
5/26/2015 8:08 PM
Unless that third version is missing text, your value doesn't seem to be the numeric you thought it was.
It may already be a datetime or it could be a character string already.
The first error, the only function that is expecting a number is the innermost TO_CHAR. And it's complaining that your timestamp isn't an number. The second is just a repeat. The third however is complaining that you are passing it a datetime when it wants a number. to_date doesn't want numbers, it wants dates. So the only thing that could be complaining there is to_char.
Try just
TO_CHAR(zztmedttrn.in_punch,'HH24:MI') - assuming it's a date
or
to_char(to_date(lpad(your_timestamp,4, '0'),'HH24MI'),'HH24:MI') - assuming it's text.
or alternatively, since you mention you have SQL Developer installed pull up the table and on the columns tab, what is the datatype the field is defined as?
thummel1
Veteran Member
Posts: 121
5/28/2015 11:32 AM
Hi All,
I was able to get a code that works. I am sharing it below:
to_char("ZZTMEDTTRN"."IN_PUNCH",'fm00G00','nls_numeric_characters=,:') as "IN_PUNCH",
The code above changes 1030 to 10:30 and 430 to 04:30.
Thank you to all who helped!
You are not authorized to post a reply.