BOB: Business Objects Board
Not endorsed by or affiliated with SAP

Register | Login 

Want to sponsor BOB? 
Want to sponsor BOB? (Opens a new window)  

General Notice: BOB is going to retire...please see details here.
General Notice: No events within the next 45 days.

Array in Crystal Report BeforeReading


 
Search this topic... | Search Crystal Reports... | Search Box
Register or Login to Post    Forum Index -> Building Reports -> Crystal Reports  Previous TopicPrint TopicNext Topic
Author Message
Sam85
Forum Member
Forum Member



Joined: 20 Sep 2018

Posts: 3



PostPosted: Mon Aug 19, 2019 2:31 am 
Post subject: Array in Crystal Report BeforeReading

Hello,

I got a Question. I will create an Array While Reading or Before Reading (not sure what might be better atm).

Code:

        dim i as number
        dim p() as number
       
        for i = 1 to Count({AUFDRUP_TXT.POSNUM})
            if not ({AUFDRUP_TXT.HiMi-IDNr} = "00") and not ({AUFDRUP_TXT.REZANT} = 100) then
                redim preserve p(i)
                p(i) = {AUFDRUP_TXT.POSNUM}
            end if
        next i
   
        Formula = minimum(p)


This is how my Formula Looks like. Now i Want to put it in the Header with BeforeReading for Example.

Header Part
Code:

beforereadingrecords
global pArr() as number
formula = pArr = 0


Detail Part
Code:

BeforeReadingRecords
Global pArr() as Number
Dim i as Number

    for i = 1 to Count({AUFDRUP_TXT.POSNUM})
        If Not ({AUFDRUP_TXT.HiMi-IDNr} = "00") And Not ({AUFDRUP_TXT.REZANT} = 100) Then
            Redim Preserve pArr(i)
            formula = pArr(i) = {AUFDRUP_TXT.POSNUM}
        end if
    next i


But that doesn't work. Does somebody know where my issue is?
It says that the Count() can't be used and must be evaluted later.
Must I do the Count() in Beforehand?

Thanks for your help.
Back to top
anil.ganga1
Principal Member
Principal Member



Joined: 04 Jul 2007
ASUG Icon
Posts: 488
Location: San Francisco


flag
PostPosted: Fri Nov 22, 2019 5:13 pm 
Post subject: Re: Array in Crystal Report BeforeReading

While I dont understand what exactly you are doing, I can tell you crystal reports process the report step by step. Go to below link to understand clearly.

https://flylib.com/books/en/2.423.1.53/1/

Count can not be done beforereadingrecords. The solution could be,
creating a subreport with a shared variable to get the count, placing that subreport on top of the current header section and use shared variables referring to the count in subreport to do your logic. You can give a try.

_________________
Thanks,
Anil.

Business Objects 6.5/XIR2/3.X/4.X
Crystal Reports 9/XI/XIR2/XIR2A/2008/2011/2013/2016
Back to top
Display posts from previous:   
Register or Login to Post    Forum Index -> Building Reports -> Crystal Reports  Previous TopicPrint TopicNext Topic
Page 1 of 1 All times are GMT - 5 Hours
 
Jump to:  

Index | About | FAQ | RAG | Privacy | Search |  Register |  Login 

Get community updates via Twitter:

Not endorsed by or affiliated with SAP
Powered by phpBB © phpBB Group
Generated in 0.0302 seconds using 17 queries. (SQL 0.0027 Parse 0.0009 Other 0.0267)
CCBot/2.0 (https://commoncrawl.org/faq/)
Hosted by ForumTopics.com | Terms of Service
phpBB Customizations by the phpBBDoctor.com
Shameless plug for MomentsOfLight.com Moments of Light Logo