Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Array problem - Address formatting Post Reply Post New Topic
Author Message
directred
Newbie
Newbie
Avatar

Joined: 26 Apr 2011
Online Status: Offline
Posts: 10
Quote directred Replybullet Topic: Array problem - Address formatting
    Posted: 04 May 2011 at 4:48am

Hi,

I get the following error, "This array must be scripted. For example: Array"
 
My code is as follows
 
Local StringVar Array strAddress;
Local NumberVar index;
Local StringVar strOutput;
local StringVar Address := Table1.Address
 
redim strAddress[10] ;

if Length (Address) = 0 then
strOutput := "No Address"
else

strAddress := SplitTable1.Address},',');
for index := 2 to UBound(strAddress) do
    strOutput := strOutput & strAddress [index] & ' ' & chr(13) ;
 
strOutput := " " & strAddress [1] & chr(13) & strOutput ;
strOutput
 
What I am trying to do is
1. Check that I have an address
2. If I have an address then build it up as an address for a document
 
In my table address = 1 Main Street, Sometown, A Region, Post Code
 
What I want displayed is
 
1 Main Street,
Sometown,
A Region,
Post Code
 
Is this the correct way or is there a better way?
 
Help
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 04 May 2011 at 5:00am
if your format is always the same you can just use a straight reaplce
 
if length(address)=0 then 'No Address'
else
replace({address},',',','+CHR(13))
IP IP Logged
directred
Newbie
Newbie
Avatar

Joined: 26 Apr 2011
Online Status: Offline
Posts: 10
Quote directred Replybullet Posted: 04 May 2011 at 5:55am
Thanks for this code. I will give it a try.
IP IP Logged
directred
Newbie
Newbie
Avatar

Joined: 26 Apr 2011
Online Status: Offline
Posts: 10
Quote directred Replybullet Posted: 04 May 2011 at 11:32pm
Works a treat.
 
Thanks for this information.
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.031 seconds.