Solved

Find Line Feed / Carriage Return

Posted on 2008-09-30
14
1,364 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
  • 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: 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.

 
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 100

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 100

Expert Comment

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

mlmcc
0
 
LVL 100

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 100

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

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.

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…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

839 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