Solved

Sort shared array using method from mlmcc

Posted on 2011-09-29
10
301 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
[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
  • 4
  • 3
  • 3
10 Comments
 
LVL 101

Expert Comment

by:mlmcc
ID: 36830804
Did it work?

What is your question?

mlmcc
0
 

Author Comment

by:mowit
ID: 36891161
How do I implement your solution using the attached report is my question.
0
 
LVL 35

Expert Comment

by:James0628
ID: 36896008
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
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.

 
LVL 101

Expert Comment

by:mlmcc
ID: 36896537
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 35

Expert Comment

by:James0628
ID: 36900655
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
 
LVL 101

Expert Comment

by:mlmcc
ID: 36900711
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 35

Expert Comment

by:James0628
ID: 36901893
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
ID: 36902677
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
ID: 36935119
worked.
0
 
LVL 35

Expert Comment

by:James0628
ID: 36903762
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
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 are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…

691 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