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.
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.
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.
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