Solved

Find Line Feed / Carriage Return

Posted on 2008-09-30
14
1,373 Views
Last Modified: 2011-10-19
Have formula in Crystal Report trided this code; received error in formula message. trying to locate the position in the string where carriage return is located, I know in the test record it is postion 15. I am learn this code need help isolating the problem

   Dim intPos         As Integer;
   Dim strString      As String;

   intPos = InStr({ODLN.Address},Chr(13))
   strstring = left({ODLN.Address}, intPos - 1)
0
Comment
Question by:johntmcii
[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
  • 6
  • 4
  • 4
14 Comments
 
LVL 4

Expert Comment

by:BostonMA
ID: 22608395
What does the error message say?
0
 

Author Comment

by:johntmcii
ID: 22608481
Error in formula Do you want to save anyway?  I answer yes then refresh... says....... remaining text does not appear to be part of the formula
0
 

Author Comment

by:johntmcii
ID: 22608533
I This is the file I am using. Found it has address, city state and country in one file, seperated by one or more sets of Od/Oa. I am trying to find the end of the first field then I will find the beginning of the second field etc
The code I sent was only the first part where I got the error

datafile.bmp
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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 4

Expert Comment

by:BostonMA
ID: 22608617
Can you try commenting out everything else in the formula except what you sent us? And then try saving it.  The problem sounds like its from another part of the formula...
0
 

Author Comment

by:johntmcii
ID: 22608703
This is all I have in the formula, this time received second message

error1.bmp
error2.bmp
0
 

Author Comment

by:johntmcii
ID: 22608740
I think the difference is it was set for Crystal syntax vs Bsic syntax; in either case I go no results
0
 
LVL 4

Expert Comment

by:BostonMA
ID: 22608787
Well if you switch to crystal syntax  and use:

local Numbervar intPos;
local Stringvar strString;


intPos = InStr({ODLN.Address},Chr(13));
strstring = left({ODLN.Address}, intPos - 1);

it should work?!
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 22608846
Crystal syntax uses := for assignment and = for comparison.
Change the = to a :=

local Numbervar intPos;
local Stringvar strString;

intPos := InStr({ODLN.Address},Chr(13));
strstring := left({ODLN.Address}, intPos - 1);

mlmcc
0
 

Author Comment

by:johntmcii
ID: 22608860
Sorry, it don't....... The remaining text does not appear to be part of the formula....same error as original same results.
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 22608869
In basic syntax there are no ; at the end of lines.  Your declarations have ;'s

mlmcc
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 22608872
What is highlighted when you get the error?

mlmcc
0
 

Author Comment

by:johntmcii
ID: 22608880
The difference in the two error messages was a result of one being in Basic Syntax mode and the other message being in Crystal Syntax mode. When I run this in Crystal Syntax mode I get the same original message, if I change to run in basic mode it will get the other error I sent.  
0
 
LVL 101

Accepted Solution

by:
mlmcc earned 250 total points
ID: 22608894
I see my comments got intrrupted

Crystal syntax for your form,ula

local Numbervar intPos;
local Stringvar strString;

intPos := InStr({ODLN.Address},Chr(13));
strstring := left({ODLN.Address}, intPos - 1);

Basic Syntax
   Dim intPos         As Integer
   Dim strString      As String

   intPos = InStr({ODLN.Address},Chr(13))
   strstring = left({ODLN.Address}, intPos - 1)
   formula = strstring

mlmc
0
 
LVL 4

Assisted Solution

by:BostonMA
BostonMA earned 250 total points
ID: 22608911
local Numbervar intPos;
local Stringvar strString;

intPos := InStr({ODLN.Address},Chr(13));
strstring := left({ODLN.Address}, intPos - 1);

This does work in crystal i just tried it
0

Featured Post

Get HTML5 Certified

Want to be a web developer? You'll need to know HTML. Prepare for HTML5 certification by enrolling in July's Course of the Month! It's free for Premium Members, Team Accounts, and Qualified Experts.

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…
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…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

617 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