1 / 66

Advanced Reports

Advanced Reports. Dr. Peter Wayne. Here is the set we will use for the report. There is a 1:many link on the 'transactionid' field. Always begin your report with the Quick Report Genie. We will group by the linking field of the parent table. Add fields from the child table. Grouping.

yovela
Télécharger la présentation

Advanced Reports

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Advanced Reports Dr. Peter Wayne

  2. Here is the set we will use for the report.

  3. There is a 1:many link on the 'transactionid' field.

  4. Always begin your report with the Quick Report Genie.

  5. We will group by the linking field of the parent table.

  6. Add fields from the child table

  7. Grouping

  8. Ordering

  9. Remove spurious summations

  10. Take advantage of formatting help

  11. Move parent table fields from the Detail section to the Group section. Move child table fields to the left in the Detail section. Shorten all the lines created by the genie and make the report 8.5" wide. You now should have a report that looks like the one in the next slide. Save the report under a name, before any accident makes you lose all your work!

  12. Now, let's add parameters to the report. • We'll ask the user for • a beginning date • an ending date • whether to include all transactions, or only reconciled transactions (status="R") We'll ask for these parameters in the OnPrintInitevent of the report.

  13. Use the Xbasic script genie to help write the event script.

  14. The genie has an option to create an Xdialog box.

  15. The Xbasic genie helps us create the xdialog.

  16. Here, I choose ls_begin_date as the variable name. I specify that it is of type "Date", that its width is 12, and I will use a calendar control to enter the date.

  17. End date is similar. A 3rd variable, "ls_include", specifies whether to include all transactions or just reconciled ones, and uses radio buttons for input.

  18. Pressing "Define radio buttons" brings up this dialog:

  19. And then we enter a title for the Xdialog box.

  20. This is important -- specify that the variables in this script are shared.

  21. Insert generated code into code editor and modify it. In my case, remove the extra quotation marks added by the genie around the default for ls_include in the line, ls_include=""all transactions""

  22. The xdialog returns 4 values: 1) varC_result contains "OK" or "Cancel" 2) ls_start_date, ls_end_date, and ls_include are all shared variables. If the user presses "Cancel", we want to abort the printing. A5v5's OnPrintInit will abort printing if a cancel() is issued. So let's add a few lines to the end of the Xdialog:

  23. Now we use the variables from our Xdialog to create a filter that can be used in the Detail, Records specification of the report. Add these lines of code: dim shared flter as c flter="between(date,{"+dtoc(ls_begin_date)+"},{"+\ dtoc(ls_end_date)+"})" if ls_include="only reconciled transactions" then flter=flter+" .and. status='R'" end Add flter to the variables for the report:

  24. Flter is defined as a session-level variable.

  25. Place the flter variable in the Report's Detail Properties section.

  26. Make eval(flter) the filter expression for the Detail section's Records property. Change "Base report on current selection of records" to "None" in Additional Record Order and Filter Criteria.

  27. We generate a very respectable xdialog when the report is previewed:

  28. Since we made the different ls_xxx variables shared variables, we can put them on the report for a more professional appearance: Here I have added them to the form's variable definition.

  29. Putting the variables on the report makes the report self-documenting.

  30. The subpayee in the child is often the same as the payee in the parent record. We can use a conditional object to suppress the superfluous display of the subpayee field. Here I have put a conditional object around the subpayee field.

  31. The first condition is Payee=Mycheckdetail->Subpayee

  32. The default condition is to show the subpayee, but if the subpayee is the same as the payee, then the field is suppressed. A similar choice is made with the subamount field:

  33. Notice that repetition of the subpayee and subpayment is now suppressed.

  34. Make one report do the work of two with a conditional object. We'll create an Account Summary report to summarize transactions by account. Since the account field is part of the detail record, we first need to create a set in which the detail items are primary. Create a 1:1 link from mycheckdetail to checkbook:

  35. Then create a Quick Report with Grouping by the Account field in Mycheckdetail:

  36. Add a session-level logical variable, show_detail, to the report definition:

  37. Place a conditional object around the entire set of fields in the Detail section of the report.

  38. Check "Object can shrink" in the properties for the conditional object: The condition is "var->show_detail=.f."

  39. Check "Shrink contents of band" in the properties for the entire Detail section:

More Related