Crystal Reports changing sorting with custom logic - sql

I need to sort a demand pick list report by BIN_id, but in an odd logic that I am not sure how to handle through crystal reports. So, bins are going to be [A-J][01-06][01-06], so for example D0306 would be one of the bin numbers.
The warehouse is set up as so (imagine the middle line of this table is where the warehouse workers will be walking).below is the format
A B
C D
E F
G H
What we want them to do is start with the "A" side of the bins, go all they way down to the farthest letter they need (up to G), switch over to the opposite side of the bin they stopped on (so if they only went down to E, they would end up at F and go up and pick from F through B). What I need to do with crystal reports is get BIN ID'S to sort like the examples below:
EDIT: A batch of orders is going to have BIN_ids that can possibly start with A-G. For example a batch of orders might have bins A0102, B0304, G0304, G0106, E0101, C0106, C0205, C0404, D0106, D0202. With this order I would want is sorted as such:
A0102, C0106, C0205, C0404, E0101, G0304, G0106, D0106, D0202, B0304
EDIT: More examples
if only A and B bins exist in the batch of orders:
A bins then B bins
if A bins through F bins exists in the batch:
A then C then E then F then D then B
if C,E,G,D exist in the batch of orders:
C then E then G then D
And so on and so on. Basically we want warehouse workers to make a U shape while they are picking through the warehouse. Start at A, go down to G, switch over to H and go up to B. This logic isn't complicated, I just have no idea how to go about doing it in Crystal...
Thanks your you help everyone, let me know if something doesn't make sense.

Your explanation is very confusing!!!!
After reading multiple times I understood you want to sort the report in the way you wish to and my solution will be according to this.
You need to manually apply sorting on the filed that is obtained from database so the solution should be:
Group the report according to the required field now when insert group window is appeared then go to tab "Group in Specefied order" and at that tab set the way you want to view the report.
If I am totally out of your problem.. Explain clearly will try to help.

Related

Randomisation - Partial Incomplete Block Design

I'm looking to replicate this randomisation in R studio.
Key features:
A and B are the primary comparison and must have 2 by 2 cross over design (i.e., occur togeather in each sequence)
The incomplete block design should include C D E and F - comparisons of interest are C vs D and E vs F. These comparisons need to occur the same number of times within the whole design, and one comparison must occur in each sequence
C D E F need to be balanced so that they occur the same number of times in a sequence
C D E F need to be balanced so that occurr the same number of times across periods
Any help would be greatly appreciated.
Many thanks.
The code I tried below is just for the incomplete block design C,D,E,F but I can't get it to balance across periods.
library(crossdes)
out=find.BIB(4,20,3, iter=1)#each dosed 6 times achieving first order balance
out
isGYD(out)
I had then planned to join on the A and B rand.

Parse data from Morningstar Direct to worksheet

I have to put together a report every quarter using data pulled off of Morningstar Direct. I have to automate the whole process, or at least parts of it. We have put this report together for the last two quarters, and we use the same format each time. So, we already have the general templates for the report - now I'm just looking for a way to pull the data from Morningstar and putting into the templates correctly.
Does anyone have any general idea where I should start?
A B C D E F
Group Name Weight Gross Net Contribution
Equity 25% 10% 8% .25
IBM 5% 15% 12%
AAPL 7% 23% 18%
Fixed Income 25% 5% 4% .17
10 Yr Bond 10% 7% 5%
Emerging Mrkts
And it goes on breaking things into more groups, and there are many more holdings within each group.
What I want it to do is search until it finds "Equity", for example, and then go over one row, grab the name of the position, its weight, and its net return, and do that for each holding in Equity. The for it to do the same thing in Fixed Income, and on and on - selecting the names, weights, and nets for each holding. Then copy and pasting them into another workbook.
Anyway that is possible?
It sounds like you need to parse your information. By using left(), right(), and mid() you can select the good data and ignore the superfluous. You could separate the data in one cell into multiple cells in the desired format.
A B
Name Address
John Q. Public 123 My Street, City, State, Zip
E (First Name) F (Middle Initial) (extra work to program missing data)
=LEFT(A2,FIND(" ",A2)) =MID(A2,LEN(E2)+1,FIND(" ",MID(A2,LEN(E2)-1,99)))
G (Last Name) H (City)
=MID(A2,(LEN(E2)+LEN(F2)+2),99) =MID(B2,LEN(H2)+2,FIND(",",MID(B2,LEN(H2)+2,99))-1)
I (State)
=MID(B2,(LEN(I2)+LEN(H2)+4),FIND(",",MID(B2,(LEN(I2)+LEN(H2)+4),99))-1)
J (Zip Code)
=MID(B2,(LEN(H2)+LEN(I2)+LEN(J2)+6),99)
This code will parse the name in the cell A2 and address in cell B2 into separate fields.
Similar cuts should allow you to get rid of the unwanted data.
==================================================================
7/8/2015
Your data seems to be your desired output. If so, please provide sanitized input data for comparison. You probably need to loop through your input to find the groups. When the group changes, prepare the summary figures.

VBA to find maximum value in a chart

I have a range of data columns A, B, and C. I have displayed as a line graph with B as the primary axis and C as the secondary axis. Column A is the category axis. I want to find the maximum value of column C and put a data callout on the point that is the maximum of column C and where column B occurs.
I know this sounds confusing. In this example, the maximum of Column C occurs at Point 27 (or 1.50% on the category axis). I would like a dot at point 27 for both Column B and C.
Column A is percentage from -5.00 to 10.00 incremented at .25%. Columns B and C are plotted against the change.
In the past I have done something similar, use a formula in column D to identify the largest number in Column C and B and make it a value high on your chart if the result is true.
Add Column D as a series to the chart.
Change the chart type on that series only to a scatter chart or something that puts points up there.
You can put a label on or simply put the amount showing above the plotted point.
You don't need VBA for this.
You might be interested to know I found a solution that works for me. First, I added columns D and E using the formula =IF(C2=MAX(C$2:C$62),C2,NA()) and =IF(C2=MAX(C$2:C$62),B2,NA()), this gave me the point on the graph for both lines B and C where B was maximum. I then formatted the graph so that these points had data callouts (a request from the client). Finally, I set columns D and E to have white font, to match the background so the appear invisible. I don't love this step, but I don't want the client to see the extra rows of #NA, etc.
The basic VBA for data callout is ActiveChart.FullSeriesCollection(5).Select
ActiveChart.SetElement (msoElementDataLabelCallout)
Where the series is 5 (column E) and I'm putting a data callout on the graphed point, which happens to be the maximum of column 3.

Mark accumulated values on a QlikView column if condition is fulfilled

I have a table in Qlikview with 2 columns:
A B
a 10
b 45
c 30
d 15
Based on this table, I have a formula with full acumulation defined as:
SUM(a)/SUM(TOTAL a)
As a result,
A B D
b 45 45/100=0.45
c 30 75/100=0.75
d 15 90/100=0.90
a 10 100/100=1
My question is. how do I mark in colour the values in column A that have on column D <=0.8)?
The challenge is that D is defined with full accumulation, but if I reference D in a formula, it doesn't consider the full accumulation!
I tried with defining a formula E=if(D>0.8,'Y','N') but this formula doesn't take the visible (accumulated) value for D unfortunately, instead it takes the D with no accumulation. If this worked, I would have tried to hide (not disable) E and reference it from the dimensions column of the table , Text colour option. Any ideas please?? Thanks
You can't get an expression column's value from within a dimension or it's properties, because the expression columns rely on the dimensions provided. It would create an endless loop. Your options are:
Apply your background colour to the expression columns, not the dimensions. This would actually make more sense as the accumulated values would have the colour, not the dimension.
When loading this specific table, have QlikView create a new column that contains the accumulated values of B. This would mean, however, that the order of your chart-table would need to be fixed for the accumulations to make any sense.
Use aggregation to create a temporary table and accumulate the values using RangeSum(). Note this will only accumulate properly if the table is ordered in Ascending order of Column A
=IF(Aggr(RangeSum(Above(Sum(B),0,10)),A)/100>0.8,
rgb(0,0,0),
rgb(255,0,0)
)

Algorithm - combine multiple lists, resulting in unique list and retaining order

I want to combine multiple lists of items into a single list, retaining the overall order requirements. i.e.:
1: A C E
2: D E
3: B A D
result: B A C D E
above, starting with list 1, we have ACE, we then know that D must come before E, and from list 3, we know that B must come before A, and D must come after B and A.
If there are conflicting orderings, the first ordering should be used. i.e.
1: A C E
2: B D E
3: F D B
result: A C F B D E
3 conflicts with 2 (B D vs D B), therefore requirements for 2 will be used.
If ordering requirements mean an item must come before or after another, it doesn't matter if it comes immediately before or after, or at the start or end of the list, as long as overall ordering is maintained.
This is being developed using VB.Net, so a LINQy solution (or any .Net solution) would be nice - otherwise pointers for an approach would be good.
Edit: Edited to make example 2 make sense (a last minute change had made it invalid)
The keyword you are probably interested in is "Topological sorting". The solution based on that would look as follows:
Create an empty directed graph.
Process sequences in order, for each two consecutive elements X,Y in a sequence add an edge X->Y to the graph, unless this would form a cycle.
Perform a topological sort on the vertices of the graph. The resulting sequence should satisfy your requirements.