Report request form

viriatoviriato Member Posts: 105
When running a form report with a date tab in the request form you have in the field list:

"Period Type"
"Period Start"
"Period End"

How do you access this data in the form code for example. Thanks

Answers

  • kapamaroukapamarou Member Posts: 1,152
    IF your dataitem is named Date in the report then:

    Date."Period Start" is the value of the field in the current record.
    Date.GETFILTER("Period Start") is the value the user entered on the request form.

    If you need the filter at the beginning you should place the commend in the OnPreReport trigger...
  • viriatoviriato Member Posts: 105
    Thanks. One more question.

    If you have let's say table with record and one of those records is a date field and you want to display them by "Period type" how would you do it?
    Let's say I would take "Period Type" Month

    January Record 1
    January Record 2
    January Record 3
    February Record 4
    February Record 5
    ...
    and so on
  • kapamaroukapamarou Member Posts: 1,152
    I would do the following:

    Example with G/L Entry:


    If I have the Date dataitem filtered to show month, then each month has a Period Start and Period End. So under the dataitem Date I would add a G/L Entry Dataitem indented one level after the date rec. Then through the propertied of the Dataitem link or through code I would do:

    "G/L Entry".SETRANGE("Posting Date",Date."Period Start",Date."Period End");


    Then in the body of the G/L Entry I would add the fields of the G/L Entry that I need and a textBox with SourceExpression Date.Name (or something similar)...


    Hope that helps...
  • viriatoviriato Member Posts: 105
    Thank you for your help.
  • kapamaroukapamarou Member Posts: 1,152
    You're welcome.
  • viriatoviriato Member Posts: 105
    One last question Kapamarou if you know.

    If i want to group some data by months in a report like if i have a time period of

    01.01.08 to 01.06.08

    Jany 5 (invoices)
    Feb 3
    Mars 10
    Apr 3
    Mai 3
    Jun 1

    Is there a easy way to display the months in Nav or would I need to create manually create a month array.
  • kapamaroukapamarou Member Posts: 1,152
    You can do that by using a Footer or Groupfooter section.

    But with the Date dataitem it could be difficult since you cannot change the keys. In that case I would add a footer on the (for example) G/L Entry dataitem.

    If I wanted to count I would print a "G/L Entry".Count in the section. If I wanted to add the Amount I would add a the amount in the totalfields property or in the Onpredataitem trigger I would do CurrReport.CREATETOTALS(Amount). Look up help for CREATETOTALS and Footers. It' easy to add automatic totals / subtotals that way...
  • viriatoviriato Member Posts: 105
    Thanks for your help Kapamarou. Have a nice weekend.
Sign In or Register to comment.