Solved

Find Line Feed / Carriage Return

Posted on 2008-09-30
14
1,356 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
 
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
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

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…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

747 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

13 Experts available now in Live!

Get 1:1 Help Now