Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

In string operator

Status
Not open for further replies.

muhaidib

Programmer
Sep 27, 2005
82
SA
In main report I created a shared stringvar which reads like ['1/2005', '22/2005'] and in subreport I wrote following formula to format the detail section-
WhilePrintingRecords;
booleanvar X:= {APTRANSdet.IDINVC} in [shared stringvar invVar];
if X= false then true;

It works but fails when values for {APTRANSdet.IDINVC} are similar. For example the subreport resulted in showing details for '2/2005' and '22/2005'. As one can see the shared stringvar contains only '22/2005'. Hence it should print details of '22/2005' and not '2/2005'.

Can anyone suggest to filter out the record with exact id.

 
2/2005" is literally found in "22/2005". I don't know how you created those values or what they represent, but you should try to format the leading values to have to digits, as in "02/2005".

-LB
 
What does "and in subreport I wrote following formula to format the detail section- : mean? WHat sort fo formatting, and where are you placing this.

Try:

Adjust your initial formula to make it an array:
whileprintingrecords;
shared stringvar arrray invVar;
redim invVar[2];
invVar := ['1/2005', '22/2005'];
1

Then the other formula is:
WhilePrintingRecords;
shared stringvar array invVar;
not({APTRANSdet.IDINVC} in invVar)

Flipping it about with boolean logic will just confuse things.

-k
 
Have a typo in there (2 rr's in array):

whileprintingrecords;
shared stringvar array invVar;
redim invVar[2];
invVar := ['1/2005', '22/2005'];
1

-k
 
Hi, Turkbear, thanks for the reply. Following details may also help you to analyse my problem.

Dear synapsevampire,
Thanks for reply. You have almost read my mind. You have given me right solution. Unfortunately it is not working (as you suspected) due to different version probably lower. I am working on Crystal Report Version 7 using ODBC connectivity, Database MS SQL.

I modified the formula text in main report as follows which does not show any syntax error.

numbervar InvCount:= count({PAYABLETCP.IDINV});
WhilePrintingRecords;
shared stringvar Array inv1Array;
if InvCount < 2 then inv1Array[1]={PAYABLETCP.IDINV};
if InvCount < 3 then inv1Array[2]={PAYABLETCP.IDINV};
if InvCount < 4 then inv1Array[3]={PAYABLETCP.IDINV};
if InvCount < 5 then inv1Array[4]={PAYABLETCP.IDINV};

am I correct in introducing the counter?

When I tried following syntax for detail section visibility in sub report, it gives syntax error after running report as "a subscript must be between 1 and the size of the array":

WhilePrintingRecords;
booleanvar X:= {APTRANSdet.IDINVC} in shared stringvar Array inv1Array[1];
if X= false then true;

Now I think you are in better position to help me.



 
I think you responded to the wrong post.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top