Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Instr with looping through an array Post Reply Post New Topic
Author Message
kevintbach
Newbie
Newbie


Joined: 19 May 2010
Online Status: Offline
Posts: 3
Quote kevintbach Replybullet Topic: Instr with looping through an array
     Posted: 29 Jul 2010 at 5:44am
so, I have an array (parameter) that I need to loop through to see if there's a hit in a text field. I need to show which ones in the array were hits.

t
ex. array of product numbers (123, 456,789)
I need to see if it's in a database field. memo004

This gets me what I want, but it times out after 45 array values. This is used in the details section.

---------
local numbervar i;
local stringvar concate;
concate :="";

    //loop through the multivariable parameter
    for i := 1 to count ({?ProductAffected}) do
        //concatenate the current value to a string seperated by commas.
        If instr({table1.Memo004},{?ProductAffected}) = 1 Then
            concate := concate + {?ProductAffected} + ", "
        Else
        If {?ProductAffected} = 'NA' Then
            Concate := "NA, ";


-------

any thoughts on how to make this work more efficient??

Thanks in advance!

Edited by kevintbach - 29 Jul 2010 at 5:51am
IP IP Logged
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