[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

Crystal 10 - Array ?

Posted on 2011-04-19
5
Medium Priority
?
333 Views
Last Modified: 2012-05-11
I am using the following formulas:

--------------------------------------------------------
Whileprintingrecords;

Global Stringvar Array Site;
ReDim Site [1];
""
--------------------------------------------
whileprintingrecords;

Global StringVar Array Site;
Global StringVar strResult;
Global NumberVar arrayUpBound;

if {@xSiteDetails} <> "" then
(
    arrayUpBound := UBound(Site) + 1;
    ReDim Preserve Site[arrayUpBound];
    Site [arrayUpBound] := {@xSiteDetails};
    strResult := "1" ;
)

else

(
    strResult := "0" ;
);
strResult
---------------------------------------------------------------

whileprintingrecords;

Global StringVar Array Site;
Join(Site,chr(10))

__________________________________

It is working fine EXCEPT when you have a Site Code that is repeated.  At the end of the invoice I only want one Site Code with Description - if the customer purchases from several Sites the sites show up in the "Legend" several times.  I want one Site Code per Site only.  How can I change the formulas to accomodate the form?

Thank you.
0
Comment
Question by:eleale
  • 3
  • 2
5 Comments
 
LVL 101

Expert Comment

by:mlmcc
ID: 35426141
Not sure what you mean.

Are you seeing "duplicate" site details or just the site number that is a problem?

Something like this?


mlmcc
if {@xSiteDetails} <> "" then 
(
    Local NumberVar index;
    Local BooleanVar NotFound := True;
    Local StringVar strSiteDetail := {@xSiteDetails};
    for index := 1 to UBound(Site)
        If Site[i] = strSiteDetail then
           NotFound  := False;
    If NotFound then
    (
        arrayUpBound := UBound(Site) + 1;
        ReDim Preserve Site[arrayUpBound];
        Site [arrayUpBound] := {@xSiteDetails};
        strResult := "1" ;
    )
    Else
        strResult := 0;

Open in new window

0
 

Author Comment

by:eleale
ID: 35426482
I am receiving Duplicate Site Codes
0
 

Author Comment

by:eleale
ID: 35426491
mlmcc

I am receiving duplicate site details -   So the customer went to the same Site 2 times - the Site Legend is reporting the Site details 2 times

00001 - Chevron Maple St
00002 - Shell 1st St
00002 - Shell 1st St
00004 - Chevron Happy St

What I need it to display as....  

00001 - Chevron Maple St
00002 - Shell 1st St
00004 - Chevron Happy St


I put the change in my formula

whileprintingrecords;

Global StringVar Array Site;
Global StringVar strResult;
Global NumberVar arrayUpBound;

if {@xSiteDetails} <> "" then 
(
    Local NumberVar index;
    Local BooleanVar NotFound := True;
    Local StringVar strSiteDetail := {@xSiteDetails};
    for index := 1 to UBound(Site)
        If Site[i] = strSiteDetail then
           NotFound  := False;
    If NotFound then
    (
        arrayUpBound := UBound(Site) + 1;
        ReDim Preserve Site[arrayUpBound];
        Site [arrayUpBound] := {@xSiteDetails};
        strResult := "1" ;
    )
    Else
        strResult := 0; 

);
strResult

I get an error that "The Key Word "DO" is missing" 
On this Line:

  If Site[i] = strSiteDetail then

Open in new window

Thank you.
0
 
LVL 101

Accepted Solution

by:
mlmcc earned 2000 total points
ID: 35427050
Sorry.  I forget the syntax for the Crystal FOR includes the DO
Two changes

    for index := 1 to UBound(Site) DO
        If Site[index] = strSiteDetail then

mlmcc
0
 

Author Closing Comment

by:eleale
ID: 35427158
Thank yoU!
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

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…
The Relationships Diagram is a good way to get an overall view of what a database is keeping track of. It is also where relationships are defined. A relationship specifies how two tables connect to each other. As you build tables in Microsoft Ac…
SQL Database Recovery Software repairs the MDF & NDF Files, corrupted due to hardware related issues or software related errors. Provides preview of recovered database objects and allows saving in either MSSQL, CSV, HTML or XLS format. Ensures recov…
Suggested Courses

611 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