Data Mapper Patterns: Distinct Values
Aug 16, 2023 12:00 PM

Data Mapper Patterns: Distinct Values

External YouTube Channel

In this post, we are going to discuss how we can retrieve distinct values from an array of records.

This post discusses the retrieval of distinct values from an array of records through the Distinct Values function. A sample file and schema, found in the linked SampleFiles.zip attachment, will be needed to build this demo. Within this file, there are two instances of the value 12, but the aim is to have only distinct values.

A sample schema available in the SampleFiles.zip file can be used for both source and destination schemas. Configuring the map involves expanding the destination and adding all source elements. The solution works by establishing a loop that transfers all records from source to destination.

Testing of the map would initially yield all records. The application of the Distinct Values function, however, requires it to be appended to the existing loop. This function can be found under the Functions panel. At this point, the Distinct Values function is ready to be expanded.

  • Retrieve distinct values using Distinct Values function
  • A sample file and schema are required from SampleFiles.zip
  • The sample schema can be used for both source and destination
  • Map configuration involves expanding the destination and adding source elements
  • Loop needs to be established to transfer records from source to destination
  • Distinct Values function is added to existing loop

Deep Dive: The Distinct Values Function

The Distinct Values function is a helpful tool when dealing with arrays of records from which distinct values need to be extracted. It works by checking all the transferred records and eliminating duplicates, thus returning only unique values. This function is particularly useful when working with large arrays, as it can simplify the array by removing redundant instances.

Setting up the function involves adding it to a loop structure within the data map. Then, it becomes a matter of testing the map and ensuring that the function performs as expected. This simplifies and streamlines the process of extracting unique values from arrays of records.

 

Read the full article Data Mapper Patterns: Distinct Values

Learn about Data Mapper Patterns: Distinct Values

 

Data Mapper Patterns involve retrieving distinct values from an array of records using the Distinct Values function. It requires a sample file and schema for both the Source and Destination. The map needs to be configured to create a loop to transfer all the records from the source to the destination. The Distinct Values function is added to the existing loop by clicking the + sign on the loop. After expanding the Distinct Values function, the map should be configured to select the source array, and to define the expression for the Distinct Values function. This expression needs to be configured to identify the distinct records that should be retrieved from the source array. After completing the configuration, the map should be tested to verify that the distinct records are being successfully retrieved.

 

More links on about Data Mapper Patterns: Distinct Values

Data Mapper Patterns: Distinct Values
2 hours ago — In this post, we are going to discuss how we can retrieve distinct values from an array of records. We will be able to achieve this using the ...
How to validate uniqueness in Data Mapper Pattern?
Dec 22, 2017 — How do I validate a unique field in an object/entity (e.g. $user->name ) without it be aware of data mapper and storage (i.e. $user cannot ...
How do Repository and Data Mapper patterns work together?
Jun 28, 2023 — For querying, the Repository relies on a schema provided by the DataMapper (e.g. the jobTitle value is found in the JobTitle column in the ...
Data mapper design pattern in php | by Miladev95
May 21, 2023 — Implementing the Data Mapper pattern in PHP involves creating separate classes for domain objects and data mappers. The data mapper classes ...
P of EAA: Data Mapper - Martin Fowler
The Data Mapper is a layer of software that separates the in-memory objects from the database. Its responsibility is to transfer data between the two and also ...
ORM Patterns: The Trade-Offs of Active Record and Data ...
Sep 11, 2018 — Among ORMs, there are a two very common philosophies or patterns: Active Record and Data Mapper. These two have advantages and disadvantages ...
2.4. Data Mapper — DesignPatternsPHP 1.0 documentation
A Data Mapper, is a Data Access Layer that performs bidirectional transfer of data between a persistent data store (often a relational database) and an in ...
Active Record vs Data Mapper - typeorm - GitBook
In data mapper your entities are very dumb - they just define their properties and may have some "dummy" methods. Simply said, data mapper is ...
Active Record vs Data Mapper patterns in PHP
Mar 15, 2022 — Active Record and Data Mapper are among the most popular patterns for mapping application objects to their database representations.

Keywords

Microsoft Expert, Data Mapper Patterns, Distinct Values, Array, Retrieve Values, Distinct List, Exclude Values, Map, Transfer Records, Distinct Values Function, Sample Files, Schema, Source Schema, Destination Schema, Loop, Functions Panel