Solved

Sort shared array using method from mlmcc

Posted on 2011-09-29
10
293 Views
Last Modified: 2012-05-12
I would like to sort the attached report using this method. Is this possible ?
sort order should be the following:
date
client matter
amount

The formula GetShipType uses a shared NumberVar Array.
shared NumberVar Array shipType;
shipType[Int(ToNumber(Right({SOP10200.SOPNUMBE}, 3)))]

Shared variables are evaluated in the last pass ad cannot be used for sorting.

There is a trick that should work.
Make a copy of this report
Edit the copy
   Delete the report header
   Delete the subreport
   Delete the information in the page header
   Save the report as FG-Inventory-Sub

Open the original report
Add a formula to the main report header A
shared NumberVar Array shipType;

Delete the group and all the information in the detail section

Add a formula
Name - @Group1
WhileReadingRecords;
' '

Add a group to the report using that formula
Insert FG-Inventory-Sub report as a subreport in the group header or footer

Suppress the detail section of the main report

mlmcc
report.rpt
0
Comment
Question by:mowit
  • 4
  • 3
  • 3
10 Comments
 
LVL 100

Expert Comment

by:mlmcc
Comment Utility
Did it work?

What is your question?

mlmcc
0
 

Author Comment

by:mowit
Comment Utility
How do I implement your solution using the attached report is my question.
0
 
LVL 34

Expert Comment

by:James0628
Comment Utility
Maybe mlmcc can figure it out, but, FWIW, what you posted doesn't really make sense to me.  You've apparently quoted some post that was referring to another report, but without the report, or at least more information, it doesn't really make sense.

 There are formulas using an array variable named shipType, but no indication of how/where/what values are put into that variable.  Then again, the variable isn't actually used anywhere either (in the lines that you posted), so I guess it doesn't matter what's in it.

 There are instructions to make a copy of a report, delete some stuff and use that as a subreport, but without seeing the report, I have no idea what that was supposed to accomplish (What was deleted?  What was left behind?).

 Then it says to create a group in the main report on a formula that only seems to produce one value (""), which seems pretty pointless, and put the subreport in the group header, but without any kind of link between the main report and subreport, so the subreport would presumably produce the same information that the main report used to, minus the deleted things, so that doesn't really seem to accomplish anything.

 So, after all my complaining :-), the upshot is that you really should have included a link to the question that that post came from.  If a solution had been accepted for that question, there should be an "ask a related question" link just above the Comment box at the bottom of the page.  You could use that to create a new question that included a link back to that question for reference.

 As for your report, I looked at it briefly and my first question would be, do you really need those subreports?  The main report and subreports appear to be reading the same tables.  Why do you need the subreports?  Just wanted to ask, before you spend too much time trying to figure out how to sort the report by values stored in shared variable arrays.  If nothing else, it will help us understand how your report works.

 James
0
 
LVL 100

Expert Comment

by:mlmcc
Comment Utility
Here is the link.  It is from 3 years ago
http://www.experts-exchange.com/Database/Reporting_/Crystal_Reports/Q_23520519.html

I haven't looked at it detail but I honestly can't recall what I was thinking when I provided that answer.

mlmcc
0
 
LVL 34

Expert Comment

by:James0628
Comment Utility
Thanks for the pointer.  I looked at it and I don't get it.  :-)  The whole idea is to sort based partly on the values from a shared array variable, but your post doesn't include anything about creating a sort.  It does create a group, but that's based on a formula that only produces one value, so no sorting there.  The only thing I could think of was that maybe the intent was to put the bulk of the main report in a second subreport, and sort the second subreport based on the values put in the array by the first subreport, but that wouldn't work either, would it?

 James
0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 100

Expert Comment

by:mlmcc
Comment Utility
As I recall that was the idea.  

The idea does work so long as the array values can be associated with a particular record.  It is the same basic idea that is used for graphing/charting on running totals.

mlmcc
0
 
LVL 34

Expert Comment

by:James0628
Comment Utility
OK.  I was thinking that you probably couldn't sort on shared variable values in a subreport either.

 So, getting back to the question at hand, do you think that mowit can use that idea in his report?  I think he's got 3 different arrays that he wants to sort on (date, matter and amount).

 James
0
 

Accepted Solution

by:
mowit earned 0 total points
Comment Utility
I was thinking. Look at subreport "gather check details" that's populating my arrays, if I change the sort within that subreport will the arrays populate in the correct order ?
0
 

Author Closing Comment

by:mowit
Comment Utility
worked.
0
 
LVL 34

Expert Comment

by:James0628
Comment Utility
Were you actually trying to sort the main report, or just sort the values in the arrays?  If you were just trying to sort the arrays, you could use a formula to sort them after the subreport is run, or, as you found, apply the sort in the subreport so that the values are added in the order you want.

 James
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

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…
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

743 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now