سؤال

I am working in Crystal 2011. I am extracting data from one table from the Sage CRM database (not sure if it is SQL). The group and sort should go as follows:

  1. by Date ( multiple dates per month, want to group by month and display only the last 12 months )
  2. by invoice type, have three types out of 7 that I am using

So far I have created two formulas:

  • Select month for the last 12 months and change to year and month.

NumberVar monthValue := (month({table.CreatedDate})); 
 if(DateDiff("m", {table.CreatedDate}, CurrentDate) < 13) then 
     cstr(year({table.CreatedDate}),0,"") + "-" + cstr(Monthname(month({table.createdDate})))  
     else 
         "no"

The no is used in the select expert to remove any records that is more than 12 months old

  • The second formula, selects the invoice type and this one is fine

My problem is that the dates are not being grouped properly, instead of having the following list

  • 2012-July

    Inovices €3423
    Payments € 323

  • 2012-Sept

    Inovices €3423
    Payments € 3234

  • 2012-Oct

    Payments €3423

    instead i am getting

  • 2012-Aug

    Inovices €3423
    Payments € 323

  • 2012-Dec

    Inovices €3423
    Payments € 3234

  • 2012-Nov

    Payments €3423

  • 2012-Aug

    Inovices €3423
    Payments € 323

I realise that the date is sorted like this because it takes it alphabetically but how can I sort and group by year and month and display year-Month in the chart?

chart of accounts

As you can see in the chart, the dates are not in order and are not grouped properly.

I have restarted this report so many times. I get so far and then it breaks.

هل كانت مفيدة؟

المحلول

Ok , that was a very long winded question but after reading chapter 11 of No Stress Tech Guide AGAIN, I have a better understanding of how the report takes in the data and manipulates it. The report is now grouped into month and sorted to only show records for the last 12 months.

so what did i do ?

  1. First I created a blank report
  2. Create a chart and use the advanced tab to select the data
  3. on Change of ( created Date , Invoice Type) and show Values of (totalValue)
  4. Pressed the Order button on created Date and set this section will be printed for each month
  5. Select Expert and set created Date forumla to DateDiff("m", {table.CreatedDate}, CurrentDate) < 13) (so no external formula needed.
  6. Used Select Expert to only display the invoice Types I want

So far , so good, just have to tweak it a bit now here is what the finished product looks like. enter image description here

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top