Solved

Exclude some records from totals

Posted on 2016-11-09
10
69 Views
Last Modified: 2016-11-15
I had this question after viewing Crystal reports subreports as total of main report.

What is the fastest way to skip some records in this formula? If some articles is example ="Closed"


Thanks
0
Comment
Question by:Fikri XXXXXXXX
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
  • 2
10 Comments
 
LVL 100

Expert Comment

by:mlmcc
ID: 41880595
What are you trying to do?

DO you want the "closed" records in the report?
If not simply filter them out through a RECORD SELECT statement

If you are trying to not include them in the formula (which formula)

USe an IF statement

If {YourField} <> "Closed" then
    Formula in question

mlmcc
0
 

Author Comment

by:Fikri XXXXXXXX
ID: 41880625
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 41880920
Are you trying to eliminate them from the summary list at the end?

What field is tested for CLOSED?

mlmcc
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 

Author Comment

by:Fikri XXXXXXXX
ID: 41881153
Field @mycomment. I need to eliminate it from total if this field is ="CLOSED" or empty (" ")
I added some additional function to this field like you did it on field @mycomment1, but principle is same.
Thanks
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 41881375
I a problem with that.

The buildlist formula is used in GH2 but the mycomment formula is in GF3 so the 2 are never in sync.

Can you give an example of the report that shows what you want?

mlmcc
0
 

Author Comment

by:Fikri XXXXXXXX
ID: 41881692
Sorry, I confused you. We can work on your example, that is ok, I need idea, I will then change it later.

In your example formula for building is in GH2, and field for checking is {@ARTICLE}.
I need to exclude some {@ARTICLE} = "CLOSED" and  {@ARTICLE} = empty string.

Is it possible to disable WhilePrintingRecords in some cases or I must do changes in code for building array?


This is part of code for building : zBuildLists:

WhilePrintingRecords;
Global NumberVar numOrders;
Global StringVar Array Article_List;
Global StringVar Array OrderQty_List;

Local NumberVar index;
Local BooleanVar NotFound;

NotFound := True;
Index := 1;

// While NotFound and Index <= numOrders do     --here I tried to exclude but that is wrong!
While NotFound and Index <= numOrders and {@ARTICLE}="CLOSED"  do
(
    If Article_List[Index] = {@ARTICLE} then
    (
        NotFound := False;
        Index := Index;
    )
    Else
        Index:= Index + 1;
);

and continue...
0
 

Author Comment

by:Fikri XXXXXXXX
ID: 41883682
Easiest way here will be option to stop executing WhilePrintingRecords... I don't know is that possible?

Thanks
0
 
LVL 35

Accepted Solution

by:
James0628 earned 500 total points
ID: 41883950
I'm not sure what you're trying to do with WhilePrintingRecords.  That just controls which report pass a formula is evaluated in, not which records it's evaluated for.  If you're interested in specific {@ARTICLE} values, I don't think that "disabling" WhilePrintingRecords will change anything.

 I haven't tried to check other formulas or anything else in the report, but if you simply want to exclude the records where {@ARTICLE} is "CLOSED" or blank from being saved in that formula, the simplest thing would seem to be to add another If statement, like this:

WhilePrintingRecords;
Global NumberVar numOrders;
Global StringVar Array Article_List;
Global StringVar Array OrderQty_List;

Local NumberVar index;
Local BooleanVar NotFound;

NotFound := True;
Index := 1;

If {@ARTICLE} <> "CLOSED" and {@ARTICLE} <> "" then
(
  While NotFound and Index <= numOrders do
  (
      If Article_List[Index] = {@ARTICLE} then
      (
          NotFound := False;
          Index := Index;
      )
      Else
          Index:= Index + 1;
  );
  If NotFound then
  (
      numOrders := numOrders + 1;
      ReDim Preserve Article_List[numOrders];
      ReDim Preserve OrderQty_List[numOrders];
      Article_List[numOrders] := {@ARTICLE};
      OrderQty_List[numOrders] := CStr({spilInvNumLines.fQuantity},0,'');
  )
  Else
  (
      OrderQty_List[Index] := CStr({spilInvNumLines.fQuantity} + Val(OrderQty_List[Index]),0,'');
  )
);

''

Open in new window


 If {@ARTICLE} is "CLOSED" or blank, it just skips everything after that.

 James
0
 

Author Closing Comment

by:Fikri XXXXXXXX
ID: 41887735
That is it. I done same things but I have few errors with ")".
Thank you.
0
 
LVL 35

Expert Comment

by:James0628
ID: 41888210
You're welcome.  Glad I could help.

 James
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
Suggested Courses

751 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