Item Reporting

Sometimes there is a need to track what the user has done to a particular item. While item history solves most of those use cases, there are some scenarios that require a different level of tracking. For example, suppose there was a data grid of media items, and there is a need to keep track when the user has viewed the media item. The current item history does not help with that.

LPK offers item reporting, which takes in one or many LDMItems and reports on it based on the configuration item "ItemReporting".

    {
      "name": "itemType",
      "primary": true
    },
    {
      "name": "reportType"
    },
    {
      "listElementType": "block",
      "dataType": "list",
      "name": "reportFields",
      "blockType": "SetField"
    },
    {
      "listElementType": "block",
      "dataType": "list",
      "name": "criteriaFields",
      "blockType": "MatchField"
    },
    {
      "dataType": "boolean",
      "name": "sendDuplicates"
    }
  • Item Type is the name of the type you wish to report on
  • Report Type is the name of the type that will be generated
  • Report Fields allows you to list key value pairs that will be set when the report item is generated
  • Criteria Fields allows you to list key value pairs to be more specific as to what to report

Below is an example of an ItemReporting in JSON:

 "data": {
    "itemType": "MediaAbstract",
    "reportType": "MediaReport",
    "sendDuplicates": false,
    "criteriaFields": [
      {
        "field": "mediaType",
        "valueList": [
          "video"
        ]
      }
    ],
    "reportFields": [
      {
        "field": "mediaId",
        "statement": "mediaId",
        "isPrimary": "true"
      },
      {
        "field": "userId",
        "statement": "currentUserId()",
        "isPrimary": "true"
      },
      {
        "field": "time",
        "statement": "now()"
      }
    ]
  }

Using LPK, the developer will need to using LDKItemReporter in order to start the process.

- (void) reportItem:(LDMItem*) item;

Using the example above, if the item passed in is of type MediaAbstract, then it will generate a new item of type MediaReport, but only if the MediaAbstract has a mediaType of video. When the MediaReport item is generated, it will take the mediaId from the MediaAbstract item, and also fill in the userId based on the current user logged in, as well as the current time.

results matching ""

    No results matching ""