Crystal Reports- use other records for condition? - database

I am somewhat new to crystal reports and the syntax involved, and cannot seem to find the specifics by searching.
The problem is,
I need to check a condition of another record (linked as in image) for when Op No=10 in table Route, I must then check the Date Complete of this record in table WO Route Schedule for the same OP (see image for how they are linked) with a date input by user when the report is ran.
Table links
The jist is, im trying to show the font of a field in red when Date Complete>=FDate (user) (FOR OP 10), but since the actual list i am generating is of OPs that are not 10, I cannot seem to point crystal to look for when Op No=10, which is linked to the current OP by Route_ID and Work Order_ID! I have been trying many If statements, as well as using a case statement for when Op_No=10, but to no avail.
As a novice, I am not entirely sure of what other information is needed. Hopefully the images help explain my motive, but please ask for more info if you think this problem can be solved.
Regards
EDIT: More context if it helps (first comment)
Yeah it's hard to explain without overdoing the details, but each work order (WO) has around 100 operations (OPs). Now, crystal reports generates a list of OPs which are still active on the shop floor, but firstly it must check if a certain OP has been completed FOR THAT work order, which then produces a field with red font for when OP number 10 is completed. Now, if I was to simply put If {WO_Route_Schedule.Date_Complete}>={?FDate} , it would use the current OPs complete date, not OP No 10 for that Work order!

ok try below solution:
Place below condition in record selection formula .
{WO_Route_Schedule.Date_Complete}>={?FDate}
to find record selection formula go to File--> selectin formula ---> record
Place the op field OP No in detail section,
Now right click the op no field go to Format field ---> Tab Font ---> formula editor of color
write below condition there
if Op No=10
then crRed
else crBlack
Let me know how it goes

Related

How to stop Heap Analytics grouping assets into "OTHER" Category

I think this might be very simple.
I wrote a query in heap to tell me which users were part of an event and how many times they engaged in it during the year.
The result is a simple table with username and number of occurrences.
It worked. However, Heap has this weird behavior of choosing multiple results (maybe at random?) and throwing them into a single "Other (X other results)" category. Where x is a number of others.
So i end up with a table of 20 maybe 30 users and occurences, and one row of "Other (X other results)".
I shrunk the query to see results from a smaller subset of dates and the "Other" category disappeared.
I really need to see every individual row in my query results! Even if it's paginated.
Help! Thank you
You can export the result as a CSV. The downloaded file will contain all the results (all single entries without the grouped OTHER).
Inte the current UI, you can find Export to CSV at the top of the report view.

How do I forward an array value using an if statement comes back false?

I am trying to only pull lunch times in an array if they are over an hour long and display the full value of that time.
I've tried to use an if statement to wrap the entire code and increment if false by one. I've been searching forms trying to see what I am doing wrong but not able to find anything. I have one functioning formula that will pull all break times and display time and dates but does not work when I try to use it to find specifics ones.
Two cells that are working:
Date it happened: {=IFERROR(INDEX(Time,SMALL(IF(Reason=$K7,ROW(Duration)-MIN(ROW(Duration))+1),COLUMNS($K$7:K7))),"")}
Value of Duration: {=IFERROR(Duration(Time,SMALL(IF(Reason=$K7,ROW(Duration)-MIN(ROW(Duration))+1),COLUMNS($K$7:K7))),"")}
The formula I am trying:
{=IF(INDEX(Duration,SMALL(IF(Reason=$K7,ROW(Duration)-MIN(ROW(Duration))+1),COLUMNS($K$7:K7)))>=TIME(1,0,0),IFERROR(INDEX(Duration,SMALL(IF(Reason=$K7,ROW(Duration)-MIN(ROW(Duration))+1),COLUMNS($K$7:K7))),""),IFERROR(INDEX(Duration,SMALL(IF(Reason=$K7,ROW(Duration)-MIN(ROW(Duration))+1),COLUMNS($K$7:L7))),""))}
That formula does ignore the times that are under an hour however it pulls the same data twice. For Example the first duration formula displays the following:
1:11:46 0:59:28 1:11:51 1:10:59
The second one shows:
1:11:46 1:11:51 1:11:51 1:10:59
My ultimate goal is to have it look up a name and then for breaks/lunches but for right now I just want to to look up the lunch times. I would like it to make the output of 1:11:46 1:11:51 1:10:59 . Any thoughts?
=IFERROR(INDEX(Duration,SMALL(IF((Reason=$K7)*(Duration>=TIME(1,0,0)),ROW(Duration)-MIN(ROW(Duration))+1),COLUMNS($K$7:K7))),"")
^ That fixed it

adding new records to a subform in access

Ah! I think I figured out part of the problem. I am trying to add a new Line Item by using the PartNumber to control the data in the Line Item. This won't work because I use PartNumber as the Primary Key in tblPartData; so it won't let me add an new Line Item because of a Key Violation in tblPartData. What I really need to do is change the FKInvoiceNum.
Basically I built my queries wrong and got confused. So I've just spent about 10 hours banging my head against this. When what I should have done was just written down a describe the problem, and then think about that for awhile. You know step back and look at it from a different angle.
Thanks for providing me a venue where I had to describe my problem succinctly for others. But next time I'll write up my question then let it sit for a couple of hours; to save you all some time.
I have an Access Database with a Form and a Subform for an invoicing system based on queries to the following tables:
tblInvoiceData (InvoiceNum, FKCustomerID, InvoiceDate)
tblCustomerData (CustomerID, all data pertaining to the customer -- sorry there are about 20 fields)
tblLineItemData (FKInvoiceNum, FKPartNum)
tblPartData (PartNumber, PartDescription, FKManufacturerID)
qryInvoiceExpandedData (InvoiceNum, FKCustomerID, InvoiceDate, CustomerID, and all the Customer data fields)
qryLineItemExpandedData (FKInvoiceNum, FKPartNum, PartNumber, PartDescription, FKManufacturerID, and all the manufacturer data fields)
The Main form is frmInvoiceDetails and is based on qryInvoiceExpandedData. The Subform is frmLineItemDetail and is based on qryLineItemExpandedData (includes the following fields: FKInvoiceNum, FKPartNum, PartNumber, PartDescription, FKManufacturerID, ManufacturerID, ManufacturerName) as a continues form.
The problem is that in edit or creation mode I can not change any Line Item Data, or add new Line Items. Can anyone show me where my mistake; I need to be able to change the Line Item Data in the form and can't figure it out.
Apologies if this question type was answered else where, I was unable to find it -- I expect I'm not asking the right question of the search field.

Excel 2016 Complex Nested IF

I'm working with an Excel sheet with more than 2,000 rows. The image I've attached shows the problem. I've checked the questions on StackOverflow & I don't see anything addressing this situation:
I need a formula to calculate the percentage in column E (E is formatted as a percentage). I can do this by hand logically but it takes upwards of 15 minutes and the report needs to be produced daily. The list comes from SQL Server and I can't get my SQL query to handle this either, nor can I make it work in VBA for Excel.
Logic for Cell E3:
If C2='house' and C3='house' and C4='house', then '100'
If C2='house' and C3='house' and C4='prospect', then 'C3/SUM(C3:C4)'
If C2='house' and C3='prospect' and C4='house', then 'C3/SUM(C2:C3)'
If C2='house' and C3='prospect' and C4='prospect', then 'C3/SUM(C2:C3)'
If C2='prospect' and C3='prospect' and C4='prospect', then '100'
If C2='prospect' and C3='house' and C4='house', then, '100'
If C2='prospect' and C3='house' and C4='prospect', then 'C3/SUM(C3:C4)'
If C2='prospect' and C3='prospect' and C4='house', then '100'
Thank you, in advance, for any assistance!
Obviously there was a typo in your question, you meant to calculate with numbers on column D not C, i.e D3/Sum(D3:D4) etc.
You could try to simply write that logic with nested if's... But I realize that the rule, which looked like a digital logic exercise, is actually much simpler. In summary the equation should detect the flip from "House" to "Prospect", if any.
Try this formula at E3 and copy it down:
E3:
=D3/(D3+ (D2*(C2="House")*(C3="Prospect")) + (D4*(C3="House")*(C4="Prospect")))

SQL Server query to Crystal Reports

I am trying to move reports that currently run in SQL Server to Crystal Reports.
Essentially the statement I want to reproduce is:
SELECT DATEPART(DD,DATE), COUNT(*)
WHERE FOO = 'BAR'
GROUP BY DATEPART(DD,DATE)
Count the occurrence of records that match a criteria, grouped by date.
I have used the Selection Expert to generate a equivalence relation (to evaluate the records) and would like to use the datepart function in a group by statement. I have gotten the GROUP BY selection expert to group by date - but it is the full timestamp (SS:HH:DD:MM) not by specific day i.e. March 1 2010.
I am sure there is a way to achieve what I want but have yet to find a tutorial explaining this scenario.
Any help you could lend would be appreciated
As with any other SDK/Language, there are many ways to do this. Here is the first one that I can think of:
Get the raw data into Crystal. (Sounds like you already did this)
In Crystal, make a new formula, call it "GroupByDate". In the formula editor, enter:
datepart("yyyy-mm-dd",{mytable.mydatefield})
Go into the Group Expert. Group your report by GroupByDate.
Make a new formula, call it "AddMe". In the formula editor, enter:
iif({mytable.foo="bar",1,0)
Drag & drop your AddMe formula into the details section. Right-click on it to Insert->Summary. Set your summary location as the group footer.
Preview your report and you should see the total counts in every group footer. To simplify the appearance of the report, you can also suppress the display of the detail and grouper header sections.
Again, there are many ways to do this. You can also get creative with a Running Total function. The Crystal Formula Editor has very useful help files. Use the Functions pane to select a function, press F1, and you'll get criteria, examples, etc.

Resources