Print Page | Close Window

how to use array formula?

Printed From: Crystal Reports Book
Category: Crystal Reports for Visual Studio 2005 and Newer
Forum Name: Writing Code
Forum Discription: .NET programming API, report integration
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=11545
Printed Date: 04 May 2024 at 2:04am


Topic: how to use array formula?
Posted By: crystaliao
Subject: how to use array formula?
Date Posted: 27 Oct 2010 at 11:55pm
Local StringVar array color_type_str := Split({qryTable.COLOR_TYPE}, ",");
Local NumberVar strLen := Count ({qryTable. COLOR_TYPE});
Local NumberVar i;

For i:=1 To strLen step +1 Do
(
    if color_type_str = "A" then
    (
     "V";
     Exit For ;
     )
)

the array data is like ["A","B","C"]
1.why the result shows "True" instead of "V" or "X"?
2.and is Count() the right way to count array length, why it show double zero "00", not the correct number of elements?

thank you~



Replies:
Posted By: lockwelle
Date Posted: 04 Nov 2010 at 11:23am
I would have thought that UBound would have been the correct method...same as .NET.
 
Not sure about the True part, I don't use array very often.


Posted By: crystaliao
Date Posted: 06 Nov 2010 at 1:40am
Local StringVar array color_type_str := Split({qryTable. COLOR_TYPE}, ",");
Local NumberVar strLen := Count (color_type_str);
Local NumberVar i;
Local StringVar result;

For i:=1 To strLen step +1 Do
(
    If color_type_str = "A" Then
    (
        result := "V";       
        Exit For;
    )
);

result;


I wrote like above, it's work! :)



Print Page | Close Window