Solved

Exclude some records from totals

Posted on 2016-11-09
10
56 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
  • 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
NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

 

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 34

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 34

Expert Comment

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

 James
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Formula to get month and year from date 5 61
Cross-tab sort rows by field not displayed 6 53
Multiple Parameters in Crystal 11 77
Crystal Report sorting 6 11
I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
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…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

777 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