Solved

CONVERT in COMMANDS

Posted on 2006-06-12
6
398 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
  • 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
ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

 
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 34

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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

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…
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

831 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