I have an entity expressing employee absences split per half day (AM and PM). the entity has 4 relevant fields: the employee name (another custom entity), a reason for absence (holiday, overtime reimbursement, paid vacation, allowed leave,... 11 in total), the date of absence and whether it's an AM or PM absence (dropdown using 2 values). If an employee is absent the entire day, 2 records are made, 1 for AM and 1 for PM.

I now have to make a graph which shows the following:

Group all absences per employee (5 absent employees is 5 groups); group all absences for a specific employee per reason for absence (an employee with 2 different absences gets 2 adjacent columns in his group); The data shown is a count of all the absences, grouped by date (2 absences, 1 AM and 1 PM, on the same date should count as 1 absence, not 2). In effect, I need a count of unique dates.

I have managed to make a basic graph which has the employee and absence reason groups completed. However, I cannot figure out how to count unique dates.

What i've got so far is:

<visualization>
  <visualizationid>{CA31385D-FE63-E311-A895-005056A03018}</visualizationid>
  <name>Datum afwezigheid bij personeelsfiche en reden van afwezigheid</name>
  <primaryentitytypecode>acm_tijdindeling</primaryentitytypecode>
  <datadescription>
    <datadefinition>
      <fetchcollection>
        <fetch mapping="logical" aggregate="true">
          <entity name="acm_tijdindeling">
            <attribute groupby="true" alias="group_personeelsfiche" name="acm_personeelsfiche" />
            <attribute alias="count_datumafwezigheid" name="acm_datumafwezigheid" aggregate="count" />
            <attribute groupby="true" alias="group_redenvanafwezigheid" name="acm_redenvanafwezigheid" />
          </entity>
        </fetch>
      </fetchcollection>
      <categorycollection>
        <category alias="group_personeelsfiche">
          <measurecollection>
            <measure alias="count_datumafwezigheid" />
          </measurecollection>
        </category>
      </categorycollection>
    </datadefinition>
  </datadescription>
  <presentationdescription>
    <Chart Palette="None" PaletteCustomColors="55,118,193; 197,56,52; 149,189,66; 117,82,160; 49,171,204; 255,136,35; 97,142,206; 209,98,96; 168,203,104; 142,116,178; 93,186,215; 255,155,83">
      <Series>
        <Series ChartType="Column" IsValueShownAsLabel="True" Font="{0}, 9.5px" LabelForeColor="59, 59, 59" CustomProperties="PointWidth=0.75, MaxPixelPointWidth=40"></Series>
      </Series>
      <ChartAreas>
        <ChartArea BorderColor="White" BorderDashStyle="Solid">
          <AxisY LabelAutoFitMinFontSize="8" TitleForeColor="59, 59, 59" TitleFont="{0}, 10.5px" LineColor="165, 172, 181" IntervalAutoMode="VariableCount">
            <MajorGrid LineColor="239, 242, 246" />
            <MajorTickMark LineColor="165, 172, 181" />
            <LabelStyle Font="{0}, 10.5px" ForeColor="59, 59, 59" />
          </AxisY>
          <AxisX LabelAutoFitMinFontSize="8" TitleForeColor="59, 59, 59" TitleFont="{0}, 10.5px" LineColor="165, 172, 181" IntervalAutoMode="VariableCount">
            <MajorTickMark LineColor="165, 172, 181" />
            <MajorGrid LineColor="Transparent" />
            <LabelStyle Font="{0}, 10.5px" ForeColor="59, 59, 59" />
          </AxisX>
        </ChartArea>
      </ChartAreas>
      <Titles>
        <Title Alignment="TopLeft" DockingOffset="-3" Font="{0}, 13px" ForeColor="59, 59, 59"></Title>
      </Titles>
      <Legends>
        <Legend Alignment="Center" LegendStyle="Table" Docking="right" IsEquallySpacedItems="True" Font="{0}, 11px" ShadowColor="0, 0, 0, 0" ForeColor="59, 59, 59" />
      </Legends>
    </Chart>
  </presentationdescription>
  <isdefault>false</isdefault>
</visualization>

I've tried adding groupby="true" dategrouping="day" to the count_datumafwezigheid aggregate, but then I get an "invalid XML" error.

有帮助吗?

其他提示

I had a similar problem once - im not sure its possible to aggregate DateTime - See Thread: Fetch DateTime CRM 2011

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top