Solved

Find Line Feed / Carriage Return

Posted on 2008-09-30
14
1,366 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: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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 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: 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.

Question has a verified solution.

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

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
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…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

680 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