Solved

CONVERT in COMMANDS

Posted on 2006-06-12
6
404 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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
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…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

688 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