Login
Register
Search
Home
Forums
Jobs
LawsonGuru
LawsonGuru Letter
LawsonGuru Blog
Worthwhile Reading
Infor Lawson News Feed
Store
Store FAQs
About
Forums
Performance Management
Lawson Business Intelligence/Reporting/Crystal
Query to split string into two parts
Home
Forums
Jobs
LawsonGuru
LawsonGuru Letter
LawsonGuru Blog
Worthwhile Reading
Infor Lawson News Feed
Store
Store FAQs
About
Who's On?
Membership:
Latest:
LynneB
Past 24 Hours:
0
Prev. 24 Hours:
0
Overall:
5123
People Online:
Visitors:
317
Members:
0
Total:
317
Online Now:
New Topics
Lawson S3 Financials
PO Matched Dollars and Matched Quantity
5/10/2024 6:51 PM
Can anyone share the Lawson calculation to determi
S3 Customization/Development
COBOL CSV file
5/10/2024 2:36 PM
We have a custom Cobol program ZU200 that creates
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
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
1357
Roger French
1311
mark.cook
1244
Forums
Unanswered
Active Topics
Most Liked
Most Replies
Search Forums
Search
Advanced Search
Topics
Posts
Prev
Next
Forums
Lawson Business Intelligence/Reporting/Crystal
Query to split string into two parts
Sort:
Oldest First
Most Recent First
You are not authorized to post a reply.
Author
Messages
DavidBrianCampbell
Basic Member
Posts: 13
9/19/2007 4:44 PM
I am trying to split a number into two parts and wondering if anyone has a suggested syntax? (e.g. 107511 split into 107 and 511 and then alias each with the "AS" keyword.) Thanks!
Chris Martin posted this when I was trying two join 3 fields into one (I'm kinda doing the reverse now):
trim(last_name) || ', ' || trim(first_name) || ' ' || case when trim(middle_init) is null then trim(middle_init) else trim(middle_init) || '.' end
DavidBrianCampbell
Basic Member
Posts: 13
9/19/2007 5:16 PM
To be more specific, the field that I'm trying to split is EMPLOYEE.DEPARTMENT (String [5])
So for example I want this value: "10050" split into "100" and "50" and
SELECT EMPLOYEE.EMPLOYEE, EMPLOYEE.DEPARTMENT, rtrim(DEPARTMENT-' ') AS LAST2 ltrim(DEPARTMENT-' ') AS FIRST3 FROM EMPLOYEE
Thanks!
Chris Martin
Veteran Member
Posts: 277
9/19/2007 5:25 PM
Use the substr function:
a) substr(department,1,3) as FIRST3
b) substr(department,4,2) as LAST2
The LAST2 will only give you what you want if all of your departments 5 characters long.
k-rock
Veteran Member
Posts: 142
9/20/2007 11:42 AM
I'm not a Crystal user, but there has to be some function like LEN in excel.
substr(department, 1, 3) as FIRST3
substr(department, 4, LEN(department)-3) as LAST
that should give you the remainder of the string
John Henley
Posts: 3352
9/20/2007 2:39 PM
Brian, are you trying to do this within the SQL command itself (i.e. you're not reporting against tables but against a SQL command [or a SQL Expression in Crystal, which uses the vendor-specific SQL syntax] (and if so, what flavor: Oracle, MSSQL, etc.?), or via a Crystal Formula? The reason I ask is because the syntax is different.
You are not authorized to post a reply.