Solved

CONVERT in COMMANDS

Posted on 2006-06-12
6
391 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
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

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…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

708 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now