Solved

CONVERT in COMMANDS

Posted on 2006-06-12
6
400 Views
Last Modified: 2009-12-16
Dear All,

Here's an intesresting question for you all!!

I'm using an Excel sheet as a data source for CR10 reports, and it has a field that sometimes may be less than 255 chrs for all records, or sometimes it may be more than 255.  Crystal tends to check the field to set the data type, and tries to fix up the report and switch from String to Memo when encountering different length fields. I'd like to override this auto switching and force the field to be treated as memo regardless.  I'm trying to write a COMMAND that will force something like...


SELECT CONVERT(MEmo, table.field)

but I know the syntax / function / is not correct for this.  Any idea what it should be?

Regards

DAVE SMITH
0
Comment
Question by:davetheravesmith
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 16

Expert Comment

by:wykabryan
ID: 16885202
I would suggest one of the following:

convert(ntext, table.field)
convert(varchar(4000),table.field)<--preferrable method

Or you can do this in CR.  
Cstr(table.field)
0
 
LVL 1

Author Comment

by:davetheravesmith
ID: 16890460
That's great but it only seems to wrok in SQL views or on SQL data sources.  What I'd like to do is issue this using the Add Command area in CR, and in there it doesn't seem to work on an Excel data source.  It works fine using a SQL Server data source.  Could it be that DAO data sources such as Access / Excel can't recognise the CONVERT function?

Regards

DAVE S
0
 
LVL 16

Expert Comment

by:wykabryan
ID: 16893610
Yeah, DAO does not allow for the full functionality of SQL commands.  Your best bet is to do it in the report with a formula.  Then you can base any filters or anything else off of the formula.

CStr(table.field)
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 1

Author Comment

by:davetheravesmith
ID: 16897833
Thanks for this, but the original problem is that CR analyses the file initially, in which the field in question swtiches from <255 chrs to >255chrs, depending on what's in there this week.

So the original problem wouldn't be resolved as CR would detect the change and think the field has switched data types if you get my drift.

Is there a list somewhere of what SQL commands are valid / invalid for use the Add Command area of CR?

Regards

DAVE S
0
 
LVL 35

Expert Comment

by:James0628
ID: 16900872
I have no idea if you can do what you want in a Command in CR.  If you can't get that to work and CR has access to an SQL server, one option might be to read the Excel file in an SQL stored procedure, do your processing, and then use the stored procedure as the input to the CR report.  Although, for all I know, SQL could have the same limitation when reading the Excel file as CR does.  But it might be worth a try.

 James
0
 
LVL 16

Accepted Solution

by:
wykabryan earned 75 total points
ID: 16902023
I just tested this out.  

SELECT cstr(`Sheet1_`.`LOB Description`) as LOB
FROM   `Sheet1$` `Sheet1_`

This passed and pulls the information through.  It appear that when you use DAO some of the Crystal function become active.

Hope this helps.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question