Announcement: You can find the guides for Commerce 7.5 and later on the new Elastic Path Documentation site. The Developer Center continues to support Commerce 6.13.0 through 7.4.1.Visit new site

Reading data point values

Reading data point values

The DataPointValueServiceclass provides the DataPointValueService.getValues() method to read one or more data point values, for one or more customers. You can use the values of data points to generate reports and to display data point values of a shopper before deletion.

To get values of data points of a customer, provide a map in the following format:DataPointValueService.getValues(Map<String, ? extends Collection<DataPoint>)
String specifies a customer GUID and a list of data points to read the database values for. This method returns a collection of DataPointValue instances corresponding to data point values.
Map<String, Collection<DataPoint>> customerGuidToDataPoints = new HashMap<>(1);
DataPoint dp = new DataPoint();
dp.setName("A name");
dp.setDataLocation("CUSTOMER_PROFILE");
dp.setDataKey("CP_EMAIL");
List<DataPoint> dataPoints = Collections.singletonList(dp);
customerGuidToDataPoints .put(customerGuid, dataPoints);
List<DataPointValue> dataPointValues = dataPointValueService.getValues(customerGuidToDataPoints);