Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Crystal Reports - Formulas in detail section

Posted on 2012-08-13
14
Medium Priority
?
693 Views
Last Modified: 2012-11-09
Hi,

I have a gloabal variable x declared in a formula. I increment that field by 10.

My requirement is like below: I want to place the same formula in Page header and Detailed section. data in detailed section is not being repeated as I used the same formula.
Requirement:
Page header:
Display Value of x as 10.

Detail section: display as below.
20
30
40

Displaying as:
Page header:
10

Details Section:
20
20
20


Could you please help me how can I get the value in formula to increment when placed in detailed section?

Thanks,
Yeturi.
0
Comment
Question by:Yeturi
  • 5
  • 4
  • 2
11 Comments
 
LVL 4

Expert Comment

by:DustinKikuchi
ID: 38290163
Your formula should look something like:

Shared NumberVar x := x + 10;
x;

This will increment x by 10 and then display the new value of x.
0
 

Author Comment

by:Yeturi
ID: 38290397
I did the same.

WhilePrintingRecords;
Shared numbervar count1;
count1 := count1 + 10;

I placed the formula variable two times in the Detailed section as below:

@Numdisp
@Numdisp

The output displayed as
10
10

I am expecting
10
20
0
 
LVL 101

Accepted Solution

by:
mlmcc earned 2000 total points
ID: 38290467
You have to put it in a separate detail section or have a second formula

Crystal caches formula evaluations and knows thaqt it evaluated the formula already so just repeats the result

mlmcc
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Yeturi
ID: 38292092
Is there is any way, that within the same details section I can use one formula?

My requirement is like I cant have multiple detailed sections ans I need output like

10
20
30

Or else is there is any way, that I can have a counter that can be incremented in the same detailed section in a formula?
0
 
LVL 4

Expert Comment

by:DustinKikuchi
ID: 38292142
You may need to use the WhileReadingRecords evaluation runtime in order to have the formula properly increment within the detail section.
0
 

Author Comment

by:Yeturi
ID: 38292270
WhileReadingRecords;
Global numbervar count1;
count1 := count1 + 1;

I have rewritten the formula as above. But changed count1 from Shared to Global as it said Reading cant be with Shared.

But it dint work.. give as same..

10
10
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 38292461
Shared is intended for use with a subreport.  Global is for use within a single report.

Since subreports evaluate in the Printing Pass through the report shared variables are only valid in that pass.

I have never had a reason to update a variable as you want so I don't know if there is a way to do it.

What is the reason for doing this?

mlmcc
0
 

Author Comment

by:Yeturi
ID: 38292971
In my details section, I have a requirement like I need to have the label to increment with alphabets. I thought to use a sigle formula as I dont know in each details section how many times I will require the below.

So I have taken an array and trying to increment the counter by 1 but I am repeting the formula in teh same detailed section its not being incremented.

Is there is any way to acheive it?

like,

a
b
c
d
e
and so on..
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 38293268
The detail section only works on 1 record at a time.
DO you have a field you are trying to split into several lines each of which needs a "label"

mlmcc
0
 

Author Comment

by:Yeturi
ID: 38297100
Not sure of the question you are asking..

I have some 10 details section in the report. I will supress and enable the detailed sections based on the logic. not all the detailed sections will be invoked everytime.
The exact requirement is,, In the below, the labels for a,b,c,d,e,f,g,.. should be dynamically enabled.

Like If the logic says to display section 1 and 3 then section1 should show labels as a,b and section 3 should show as c, d.
if the logic say to display section 2,3 then labels should be as a,b,c in section 2 and d,e in section3.

Hope this is clear now. Is there is any way to acheive it?

Detailed section1:
Name           a       Datavalue
Empnum      b       Datavalue


Detailed section2:
State          c       Datavalue
Depnum    d       Datavalue
Depname  e      DataValue


Dtailed section3:
sal       f     Datavalue
Comm g    Datavalue
0
 
LVL 101

Assisted Solution

by:mlmcc
mlmcc earned 2000 total points
ID: 38297946
There is but it requires you to use a separate formula for each value.
Since you are suppressing some of the sections the formulas will have account for the suppression and not increment when the section is suppressed.

I can think of a way to do this with arrays but it might not work in your case with the suppressing of sections

mlmcc
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
If you are a mobile app developer and especially develop hybrid mobile apps then these 4 mistakes you must avoid for hybrid app development to be the more genuine app developer.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Starting up a Project

564 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