| Author |
Message |
TQ-Jeff
Newbie
Joined: 07 Jun 2010
Location: United States
Online Status: Offline
Posts: 7
|

Topic: parsing data? Posted: 09 Aug 2010 at 3:06pm |
|
Hello All,
New to Crystal Reports but from what I see so far it is Very Robust and worth Every Penny! I have been elected to create reports from our database on a bunch of things. One of the things is CPU info. The problem is that the database has a plethora of info in it. I only need about the first 20 characters. Is there a way to limit the field to the first 20 characters or so?
Thanks for the help!
Jeff
|
IP Logged |
|
|
|
nix1016
Groupie
Joined: 07 Jun 2010
Online Status: Offline
Posts: 40
|

Posted: 09 Aug 2010 at 4:28pm |
|
You can use the left command if the field is a str, e.g. left(cpu_info, 20), or left(totext(cpu_info,20)) if it isn't a str.
|
IP Logged |
|
TQ-Jeff
Newbie
Joined: 07 Jun 2010
Location: United States
Online Status: Offline
Posts: 7
|

Posted: 10 Aug 2010 at 5:43am |
Originally posted by nix1016
You can use the left command if the field is a str, e.g. left(cpu_info, 20), or left(totext(cpu_info,20)) if it isn't a str.
I am new to CR can you push me in the right direction for this? Thanks,
Jeff
|
IP Logged |
|
nix1016
Groupie
Joined: 07 Jun 2010
Online Status: Offline
Posts: 40
|

Posted: 10 Aug 2010 at 8:32pm |
|
You'll need to create a forumla for this by going to the formula workshop under the report menu and then write the formula i.e. left({tablename.fieldname},20) and then drag the formula to where you want it to display the CPU info on the report from the field explorer menu. If you can't see this menu you can toggle it under the View menu.
|
IP Logged |
|
TQ-Jeff
Newbie
Joined: 07 Jun 2010
Location: United States
Online Status: Offline
Posts: 7
|

Posted: 23 Sep 2010 at 5:08am |
|
Sorry it took so long to respond...got moved off this report and on to another more important report.
When I am in Formula Editor and create left({computers.Processors},36) I get "there is an error in this formula. Do you want to save it anyway? I click no and it gives me this error: The result of selection formula must be a Boolean. I have a Crystal Reports book but the info I have on Boolean is just the breakdown of who invented Boolean Algebra...not much help really.
|
IP Logged |
|
DBlank
Moderator
Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
|

Posted: 23 Sep 2010 at 5:17am |
your in the select expert.
that only wants boolean results to select rows of data.
you should be in the Field Explorer > Formula Fields>Right click and select New
|
IP Logged |
|
TQ-Jeff
Newbie
Joined: 07 Jun 2010
Location: United States
Online Status: Offline
Posts: 7
|

Posted: 23 Sep 2010 at 6:06am |
|
Here is the whole string that displays:
Dual-Core AMD Opteron(tm) Processor 2212:0:1995:32:131:2048:AuthenticAMD:178BFBFF00040F13-1:4:1
Is there a way to Limit it after the first : ?
The reason I ask is that every process or is different and if I allow for 36 characters some of the processors have more and some have less so it just looks ugly on a report.
Thanks!
Edited by TQ-Jeff - 23 Sep 2010 at 6:12am
|
IP Logged |
|
DBlank
Moderator
Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
|

Posted: 23 Sep 2010 at 6:11am |
|
left({computers.Processors},instr({computers.Processors},':')-1)
|
IP Logged |
|
DBlank
Moderator
Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
|

Posted: 23 Sep 2010 at 6:13am |
I think I just gave you the inverse of what you wanted.
MID({computers.Processors},instr({computers.Processors},':')+1)
|
IP Logged |
|
TQ-Jeff
Newbie
Joined: 07 Jun 2010
Location: United States
Online Status: Offline
Posts: 7
|

Posted: 23 Sep 2010 at 6:44am |
|
I need a class for this stuff! The formula is created but I cannot seem to "insert" it into the report.
|
IP Logged |
|
|
|