Crystal Report Show Database query - crystal-reports

I am a newbie at CR. I have a report that someone else created. When I use the Database -> 'Show SQL Query' command the WHERE clause has a bunch of names. How can I find out where this list of names is coming from?
SELECT "billing_tx_charge_detail_2004"."date_of_service", "billing_tx_charge_detail_2004"."v_SERVICE_CODE", "billing_tx_charge_detail_2004"."v_PROVIDER_NAME", "billing_tx_charge_detail_2004"."service_status_value", "billing_tx_charge_detail_2004"."v_client_name", "billing_tx_charge_detail_2004"."guarantor_liability", "billing_tx_charge_detail_2004"."CLAIM_NUMBER", "billing_tx_charge_detail_2004"."GUARANTOR_ID", "billing_tx_charge_detail_2004"."v_service_value", "billing_tx_charge_detail_2004"."PATID", "cw_patient_notes"."service_duration", "cw_patient_notes"."note_type_value"FROM "SYSTEM"."billing_tx_charge_detail_2004" "billing_tx_charge_detail_2004" LEFT OUTER JOIN "CWSAVPMLIVESYSTEM"."cw_patient_notes" "cw_patient_notes" ON ((("billing_tx_charge_detail_2004"."FACILITY"="cw_patient_notes"."FACILITY") AND ("billing_tx_charge_detail_2004"."PATID"="cw_patient_notes"."PATID")) AND ("billing_tx_charge_detail_2004"."EPISODE_NUMBER"="cw_patient_notes"."EPISODE_NUMBER")) AND ("billing_tx_charge_detail_2004"."JOIN_TO_TX_HISTORY"="cw_patient_notes"."JOIN_TO_TX_HISTORY")
WHERE ("billing_tx_charge_detail_2004"."date_of_service">={d '2009-07-01'}
AND "billing_tx_charge_detail_2004"."date_of_service"<={d '2009-07-31'}) AND
("billing_tx_charge_detail_2004"."v_PROVIDER_NAME"='BARNHART,SCOTT' OR
"billing_tx_charge_detail_2004"."v_PROVIDER_NAME"='BINKER,BARB MSW LISW' OR
"billing_tx_charge_detail_2004"."v_PROVIDER_NAME"='BRETNAN,BAUNEEN' OR
"billing_tx_charge_detail_2004"."v_PROVIDER_NAME"='CROWN,DWAYNE BS NCAC-I LADAC'
OR "billing_tx_charge_detail_2004"."v_PROVIDER_NAME"='COFFEE,RAMBA BA LADAC' OR
"billing_tx_charge_detail_2004"."v_PROVIDER_NAME"='DECODE,TENISE MC LMFT LADAC' OR
"billing_tx_charge_detail_2004"."v_PROVIDER_NAME"='GONSALEZ,MAREN' OR
"billing_tx_charge_detail_2004"."v_PROVIDER_NAME"='HITAN,TOM' OR
"billing_tx_charge_detail_2004"."v_PROVIDER_NAME"='KOTUE,SHEENA')
ORDER BY "billing_tx_charge_detail_2004"."v_SERVICE_CODE",
"billing_tx_charge_detail_2004"."date_of_service", "billing_tx_charge_detail_2004"."PATID"

It is found in the Report ->Select Expert command! Hooray!
I knew as soon as I posted the question I would find the answer :)

You've got some choices. It's either:
In the record selection formula (Report > Edit Selection Formula > Record)
Hard-coded in the "Show SQL Query" window (though not as likely)
In a parameter that was either saved with the report, or contains default values (even less likely)

Related

Crystal Reports Formula: Help forming IIF Statement

I am working with Crystal Reports 11.5.10.1263 [CR Developer Type: Full].
I am familiar with Programming and SQL syntax in general and have worked with expressions in SSRS & MS Access but never in Crystal Reports.
Problem:
I modified the SQL in the Crystal report and it has had the desired effect - except in the last part of the report output - where the changes I made to the SQL do not have the desired effect.
The 'desired effect' is that when a field named 'FundNumber' has the values '2595', '2597' Then the field named 'Organization' should be assigned the value '41600'.
The Detail Record in the Report has the following three rows as part of its 'Formula':
+ IIf({Data.Payments} > 0, "+01W ", "-01W ")
+ Left({Data.FundNumber}+ SPACE(6),6)
+ Left({Data.Organization}+ SPACE(6),6)
I want to change the Data.Organization row to an IIF Statement that says [pseucode]:
IIf Data.FundNumber IN ["2595", "2597"] Then "41600" Else Data.Organization
I believe the Left() function is saying 'return the left 6 characters of [Data.Organization + 6 Spaces] ?? and that it has to do with the way the data is presented in the output.
I would appreciate help with creating the IIF statement for this.
I included the 'IIf({Data.Payments} ...' row in case that helps - as my google searches have turned up examples that use IF instead of IIF.
Thanks!
The syntax most of the time is the same as VB. Try
IIF({Data.FundNumber} = "2595" or {Data.FundNumber} = "2597", "41600", {Data.Organization})

my report run but does not display anything in oracle

I have designed report in 10g. When I call report through forms 10g than report executed but do not display anything. Kindly help me what I have to do to resolve this issue. I use .rep report and desformat is PDF. One thing more when in this desformat my report started downloading instead of giving a preview in internet explorer and downloaded pdf is empty (contain nothing).
Report displays the result of a query. So the most obvious question is: does the query, when you run it outside of the Forms/Reports application, work correctly and returns the result?
If it accepts certain parameters, verify that they are correctly passed. Mind the datatype, especially if DATE is involved as people usually have problems with different format masks, NLS settings and stuff.
Also, check whether those parameters are obligatory or not. If not, report's query should contain something like
where (some_value = :parameter_value or :parameter_value is null)
Furthermore, make sure that all those parameters are passed to the report. You can display their values in the report, just to see what's going on. Open Reports Paper Layout Editor, go to the margin and - using the ampersand notation - display those values, such as
Parameter one = &parameter_one
Parameter two = &parameter_two

Crystal Report XI If statement not working: not getting to else

I have a problem with an If statement in Crystal Reports XI.
This is my code:
IF {ANAGRAFICACF.CODLINGUA} = {DESCRARTICOLI.LINGUA}
THEN
{DESCRARTICOLI.DESCRIZIONEAGG}
ELSE
{RIGHEDOCUMENTI.DESCRIZIONEART};
The problem is that Crystal Reports retrieves only lines with the condition verified and completely ignores the else condition. So if in my documents there are 10 lines, it show me the only 2 that have the condition verified.
Can you explain why? I think this is OK. It's only a simple if statement.
There more details as you request:
I tryed also this code
IF NOT ISNULL({DESCRARTICOLI.DESCRIZIONEAGG}) AND {TESTEDOCUMENTI.CODLINGUA} <>0
THEN
{DESCRARTICOLI.DESCRIZIONEAGG}
ELSE
{RIGHEDOCUMENTI.DESCRIZIONEART}
For this last code I have this structure:
TESTEDOCUMENTI.CODLINGUA is numeric like in all other tables. So for English I've "1" for default I've "0"
DESCRARTICOLI.DESCRIZIONEAGG is the translation, so in DESCRARTICOLI
I've for example CODART CODLINGUA DESCRARTICOLI (Article code, Language Code, Article Translated Description)
RIGHEDOCUMENTI.DESCRIZIONEART is the standard italian description that I see in my ERP. So I've different columns including IDRIGA CODART DESCRIZIONEART (Line ID, Article Code, Italian Language Description)
Then I've TESTEDOCUMENTI table that contain the language CODLINGUA between columns. This table has the general setting of a single document.
So in my Cristal Report table setup I've linked the 3 tables RIGHEDOCUMENTI TESTEDOCUMENTI and DESCRARTICOLI and in particular TESTEDOCUMENTI.CODLINGUA with DESCRARTICOLI.CODLINGUA and RIGHEDOCUMENTI.CODART with DESCRARTICOLI.CODART.
When the translation is not stored in the article in the erp the DESCRARTICOLI.DESCRIZIONEAGG for this Article code doesn't exist. For example. If my CODART is "abg" in RIGHEDOCUMENTI I've CODART "abg" DESCRIZIONEART "ciao". Then in DESCRARTICOLI I've CODART "abg" CODLINGUA "1" DESCRIZIONEAGG "hI". If the translation is not stored the line in DESCRARTICOLI doesn't exist.
So my need is to verify if TESTEDOCUMENTI.CODLINGUA is different from "0" default language, but this is not enough because, most of my article hasn't the translation stored. So I need to show, the italian one, or a simple message telling me "no translation stored". I've tryed also to put this message instead of RIGHEDOCUMENTI.DESCRIZIONEART but it doesn't appear.
Another strange thing is that, in my document, on the same line I've also, in separate field in the report, the CODEART, MEASURES, PRICE. If I put directly RIGHEDOCUMENTI.DESCRIZIONEART without if statement, I see all those fields. Insted in I put the if statement I don't see neither thouse other fields..
It seems like that the first think it go to read the Translation Table DESCRARTICOLI, it doesn't come back to read the original one, so end the cicle through lines, without reading all parameters stored in the RIGHEDOCUMENTI tables, containing all data that don't appear in the report.
I hope to have been more clear now.
Thank you!

Crystal Reports not putting a record on the page

I have a very odd error with a report. There is one record in the record set returned to the report that is not printing on the page. When I copy the SQL statement and run it directly in SQL Server Management Studio, the row is there so I know it isn't in the selection formula. That also tells me table/view linking is correct (although I double checked that as well). I have gone through all of the grouping levels and looked at suppression settings and group sorting. Essentially, I have exhausted all options that I can find that would be causing this record to be suppressed and can't find anywhere that it would be suppressed or hidden from view. I haven't seen this behavior ever in 22 years of working with Crystal.
Any ideas of what may be causing one record to be suppressed while all others around it are still visible? I'm on version 2013, support pack 4 (14.1.4.13274). I would prefer not to rebuild this report from scratch if I can avoid it but I'm very close to the edge on this one.
Query as requested:
SELECT "KENNEL"."KENNEL_NO", "KENNEL"."ANIMAL_ID", "KENNEL"."TAG_NO", "ANIMAL"."YEARS_OLD", "ANIMAL"."MONTHS_OLD", "ANIMAL"."ANIMAL_ID", "ANIMAL"."PRIMARY_BREED", "ANIMAL"."SECONDARY_BREED", "ANIMAL"."PRIMARY_COLOR", "ANIMAL"."SECONDARY_COLOR", "ANIMAL"."ANIMAL_TYPE", "KENNEL"."OUTCOME_DATE_NULL", "v_tx_feed_sheet"."visit_type", "v_tx_feed_sheet"."resolved_date", "v_tx_feed_sheet"."visit_date", "v_tx_feed_sheet"."CONDITION_TYPE", "v_tx_feed_sheet"."TREATMENT_DESC", "dfl_kennel_groupings"."Ani_Loc_Sub", "dfl_kennel_groupings"."Ani_Loc", "KENNEL"."OUTCOME_TYPE", "KENNEL"."OUTCOME_SUBTYPE", "KENNEL"."OUTCOME_DATE", "v_tx_feed_sheet"."CYCLE", "v_tx_feed_sheet"."MEDICATION", "v_tx_feed_sheet"."NUM_DAYS", "dfl_kennel_groupings"."Offsite_Knl", "KENNEL"."INTAKE_DATE", "KENNEL"."REASON", "ANIMAL"."age_now", "ANIMAL"."DOB"
FROM (("ANIMAL"."SYSADM"."KENNEL" "KENNEL" INNER JOIN "ANIMAL"."SYSADM"."dfl_kennel_groupings" "dfl_kennel_groupings" ON "KENNEL"."KENNEL_NO"="dfl_kennel_groupings"."Kennel_No") LEFT OUTER JOIN "ANIMAL"."SYSADM"."ANIMAL" "ANIMAL" ON "KENNEL"."ANIMAL_ID"="ANIMAL"."ANIMAL_ID") LEFT OUTER JOIN "ANIMAL"."SYSADM"."v_tx_feed_sheet" "v_tx_feed_sheet" ON "KENNEL"."ANIMAL_ID"="v_tx_feed_sheet"."ANIMAL_ID"
WHERE "ANIMAL"."ANIMAL_TYPE"='DOG' AND "KENNEL"."KENNEL_NO" NOT LIKE 'DHA%' AND NOT ("KENNEL"."KENNEL_NO"='HOME' OR "KENNEL"."KENNEL_NO"='LOST') AND "KENNEL"."KENNEL_NO" LIKE 'B%' AND "dfl_kennel_groupings"."Offsite_Knl"='N' AND (("KENNEL"."OUTCOME_DATE_NULL"='Y' AND ((("v_tx_feed_sheet"."resolved_date">={ts '1899-12-30 00:00:00'} AND "v_tx_feed_sheet"."resolved_date"<{ts '1899-12-30 00:00:00'})) OR ("v_tx_feed_sheet"."resolved_date" IS NULL ))) OR ("KENNEL"."OUTCOME_DATE_NULL"='Y' AND "ANIMAL"."YEARS_OLD"=0 AND "ANIMAL"."MONTHS_OLD"<=4) OR ("ANIMAL"."ANIMAL_TYPE"='DOG' AND "KENNEL"."OUTCOME_SUBTYPE" LIKE 'SURG%' AND ("KENNEL"."OUTCOME_DATE">={ts '2017-04-26 00:00:00'} AND "KENNEL"."OUTCOME_DATE"<{ts '2017-04-27 00:00:00'})) OR ("ANIMAL"."ANIMAL_TYPE"='DOG' AND "KENNEL"."OUTCOME_SUBTYPE" LIKE 'SURG%' AND ("KENNEL"."OUTCOME_DATE">={ts '2017-04-27 00:00:00'} AND "KENNEL"."OUTCOME_DATE"<{ts '2017-04-28 00:00:00'})) OR ("ANIMAL"."ANIMAL_TYPE"='DOG' AND ("KENNEL"."INTAKE_DATE">={ts '2017-04-27 00:00:00'} AND "KENNEL"."INTAKE_DATE"<{ts '2017-04-28 00:00:00'}))) AND NOT ("KENNEL"."REASON"='DOA' OR "KENNEL"."REASON"='EUTH' OR "KENNEL"."REASON"='EUTH BEHAV' OR "KENNEL"."REASON"='EUTH ILL' OR "KENNEL"."REASON"='EUTH OLD' OR "KENNEL"."REASON"='EUTH OTHER' OR "KENNEL"."REASON"='EUTH YOUNG')

Error in Opening Report from Form

I have a Form which will help me to filter out the records I want for my Report. The button will open the Report On Click.
This is the code in the button:
Private Sub Open_OEE_Click()
DoCmd.OpenReport "OEE_Report", acViewReport, , , acWindowNormal
End Sub
I keep getting the error:
I also have placed the query in my report under the Record Source as:
SELECT * FROM 3_OEE WHERE ((([3_OEE].RecordID)=Forms![3_OEE_Report]!cboRecordID) And (([3_OEE].Date_Recorded)=DateValue(Forms![3_OEE_Report]!Date_Recorded)) And (([3_OEE].MC_No)=Forms![3_OEE_Report]!cboMCNo) And (([3_OEE].Product)=Forms![3_OEE_Report]!cboProduct));
I want to search based on one criteria (text box or combo box) and not all four at once.
Am I missing out something?
MS-Access does tend to go a bit overboard with the brackets. Make the report's Record Source a bit easier to read by trimming out the unnecessary ones. You also need to get your date criterion in the right format - Access always uses US formatting in SQL queries and needs # signs around the date:
SELECT * FROM 3_OEE
WHERE [3_OEE].RecordID = Forms![3_OEE_Report]!cboRecordID
And [3_OEE].Date_Recorded = Format(Forms![3_OEE_Report]!Date_Recorded, "\#mm/dd/yyyy\#")
And [3_OEE].MC_No = Forms![3_OEE_Report]!cboMCNo
And [3_OEE].Product = Forms![3_OEE_Report]!cboProduct;
I would also suggest creating a named query for this and setting the report's Record Source to the named query. You can then test the query in isolation without having to run the report (but make sure the Form is open and the relevant controls are populated).
I asked for help from another source.
Answer to Question