List Lookup Transformation
The List Lookup transformation object is a type of lookup that stores information in the metadata. This means that your lookup data is stored in the dataflow itself. List Lookup uses a list of values for both the input and output fields.
You can use it to look up certain values in your source data and replace them with other desired information. Or you can define a list of values in the lookup grid in properties, and the value is then looked up in the grid when you run your dataflow.
Let’s see how this object functions in Astera.
Use Case
In this example, we are working with a Customers Fixed-Length File Source that contains customer information for a fictitious organization. The Customers data contains information about customers belonging to different countries.
We want to convert the country names in this data into CountryCodes by using the List Lookup transformation object.
How to Work with List Lookup in Astera
Drag and drop a Fixed Length File Source from the Sources section in the Toolbox to the designer window.
![](https://documentation.astera.com/~gitbook/image?url=https%3A%2F%2F3891069449-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F28dJIkGHacXhBlux3efx%252Fuploads%252FpdNxFRLbcjaIl8X671SW%252F1.png%3Falt%3Dmedia%26token%3D7c23978c-47d1-4115-8c94-2260a4a5d2f4&width=768&dpr=4&quality=100&sign=57ff747c&sv=1)
To preview the incoming data, right-click on the source object’s header and select Preview Output.
![](https://documentation.astera.com/~gitbook/image?url=https%3A%2F%2F3891069449-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F28dJIkGHacXhBlux3efx%252Fuploads%252FjbfZVSXJIlPvKIOeP0qn%252F2.png%3Falt%3Dmedia%26token%3Da590a7f4-2a5f-4e4d-a3e5-529409bfeeea&width=768&dpr=4&quality=100&sign=8cc3866c&sv=1)
To start working, drag and drop the List Lookup object from Toolbox > Transformations > List Lookup.
![](https://documentation.astera.com/~gitbook/image?url=https%3A%2F%2F3891069449-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F28dJIkGHacXhBlux3efx%252Fuploads%252FovPg3H1AIM9EZt89tlgV%252F3.png%3Falt%3Dmedia%26token%3Db1858191-78b1-476a-bef4-04ac41e8f761&width=768&dpr=4&quality=100&sign=8a3c70de&sv=1)
This is what a List Lookup object looks like:
![](https://documentation.astera.com/~gitbook/image?url=https%3A%2F%2F3891069449-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F28dJIkGHacXhBlux3efx%252Fuploads%252F7jGkS8FevPvtTVXYUWgV%252F4.png%3Falt%3Dmedia%26token%3D2c1e0617-87d9-4fee-8bd9-2d32af2d7d44&width=768&dpr=4&quality=100&sign=a3aa73ca&sv=1)
Map the field from the source dataset you want to look up values for, to the Value field in the List Lookup object.
![](https://documentation.astera.com/~gitbook/image?url=https%3A%2F%2F3891069449-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F28dJIkGHacXhBlux3efx%252Fuploads%252FwgxiL7UgBMKZVVC156SS%252F5.png%3Falt%3Dmedia%26token%3D1b81682c-d1d4-4aad-845e-35b956717340&width=768&dpr=4&quality=100&sign=d5c34518&sv=1)
Now, right-click on the List Lookup object and select Properties from the context menu. The List Lookup Map Properties window will now open.
Here, the first option we have is the Case Sensitive Lookup checkbox which is always checked by default. When this option is checked, the List Lookup will look up values on a case-sensitive basis. If you do not want to perform a case-sensitive lookup, you can uncheck this option.
![](https://documentation.astera.com/~gitbook/image?url=https%3A%2F%2F3891069449-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F28dJIkGHacXhBlux3efx%252Fuploads%252FZmi9qV0U1Mj0fNrgHkJO%252F7.png%3Falt%3Dmedia%26token%3D1f89f098-a6dc-4796-8c29-082c3c5a44aa&width=768&dpr=4&quality=100&sign=ebbecdd3&sv=1)
Next, you can see that there is a table where we can specify the Source Value and the Destination Value. Source Values are the values from your source data, and Destination Values are values that you want to replace with the source values.
![](https://documentation.astera.com/~gitbook/image?url=https%3A%2F%2F3891069449-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F28dJIkGHacXhBlux3efx%252Fuploads%252FzDNbDXnTwNZSBsXEGG3H%252F6.png%3Falt%3Dmedia%26token%3D45324cb8-d218-4ff1-8d66-9c23ce5d02a0&width=768&dpr=4&quality=100&sign=1638fa7d&sv=1)
For example, if we write the Destination Value as ‘DE’, against the Source Value ‘Germany’, Astera will write ‘DE’ in place of ‘Germany’ in the output.
![](https://documentation.astera.com/~gitbook/image?url=https%3A%2F%2F3891069449-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F28dJIkGHacXhBlux3efx%252Fuploads%252Fb84f690SgKYeljrhryk0%252F8.png%3Falt%3Dmedia%26token%3D06c5be8c-cf0f-413f-9180-7a267afa1012&width=768&dpr=4&quality=100&sign=3c830970&sv=1)
This is one way of specifying the lookup values. However, there can be a lot of source values, and typing them manually can be a tedious task. There is a more efficient way of doing this in Astera.
If you right-click on the List Lookup object, you can see that there is an option called Fill Lookup List with Unique Input Values.
![](https://documentation.astera.com/~gitbook/image?url=https%3A%2F%2F3891069449-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F28dJIkGHacXhBlux3efx%252Fuploads%252Fr4XpShPCEzjSxGfjrIOx%252F9.png%3Falt%3Dmedia%26token%3D19b6c590-f3ee-4f7e-a4d5-708d7d8844e6&width=768&dpr=4&quality=100&sign=c8b00ae7&sv=1)
Selecting this option prepopulates the source values in the Source Value column with unique source values.
![](https://documentation.astera.com/~gitbook/image?url=https%3A%2F%2F3891069449-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F28dJIkGHacXhBlux3efx%252Fuploads%252Fm67WaSNBOHSz1D8DWp0q%252F16.png%3Falt%3Dmedia%26token%3D063be71b-1937-49f3-b08b-5293735debdd&width=768&dpr=4&quality=100&sign=84c3987e&sv=1)
Now, all you have to do is type in the Destination Values, that is, the codes corresponding to each country name.
![](https://documentation.astera.com/~gitbook/image?url=https%3A%2F%2F3891069449-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F28dJIkGHacXhBlux3efx%252Fuploads%252F1OhmlLaIK9ZmOezFVSAs%252F10.png%3Falt%3Dmedia%26token%3D8d4cae03-c05a-49f8-acb7-a1f6cd1b9827&width=768&dpr=4&quality=100&sign=da7eca1d&sv=1)
Once you have populated the lookup list, click Next to proceed to the Lookup Options window.
![](https://documentation.astera.com/~gitbook/image?url=https%3A%2F%2F3891069449-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F28dJIkGHacXhBlux3efx%252Fuploads%252FUywbVaTW2er7c1EGS04y%252F11.png%3Falt%3Dmedia%26token%3De18ec999-208f-4ebb-a84d-8ed926e7d4a7&width=768&dpr=4&quality=100&sign=95171912&sv=1)
In case, the lookup field does not return any value for a given source value, one of the following options should be selected:
No Message – Will not mark the unmatched source value as an error or warning.
Add Error – The List Lookup table will trigger an error for the records that found no match in the lookup field.
Add Warning – The List Lookup will generate a warning and return a null value for records from the source that do not have any matches in the lookup table.
![](https://documentation.astera.com/~gitbook/image?url=https%3A%2F%2F3891069449-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F28dJIkGHacXhBlux3efx%252Fuploads%252Fdvsf2GaAZKOAYScw5L6w%252F12.png%3Falt%3Dmedia%26token%3Dd2893319-1279-4fad-8e2a-68aa76f680ce&width=768&dpr=4&quality=100&sign=e72cc26&sv=1)
Additionally, when the value is not found in the lookup list, you can choose from the following options to assign it a value:
Assign Source Value – Will return the original value from the source.
Assign Null – Will return a null value for each unmatched source record.
This Value – You can type in a specific value in the given field, and the List Lookup will return the same value for each unmatched source value.
![](https://documentation.astera.com/~gitbook/image?url=https%3A%2F%2F3891069449-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F28dJIkGHacXhBlux3efx%252Fuploads%252FPABoA2zURL3CXCxBu7ap%252F13.png%3Falt%3Dmedia%26token%3Da1e67aa6-664c-40c9-97a9-2d964cf4c3b8&width=768&dpr=4&quality=100&sign=cfcfa425&sv=1)
In this example, we will add an error and return the source value if the lookup value is not found. We will select the Add Error and Assign Source Value options. You can choose your preferred option and click OK.
![](https://documentation.astera.com/~gitbook/image?url=https%3A%2F%2F3891069449-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F28dJIkGHacXhBlux3efx%252Fuploads%252FUywbVaTW2er7c1EGS04y%252F11.png%3Falt%3Dmedia%26token%3De18ec999-208f-4ebb-a84d-8ed926e7d4a7&width=768&dpr=4&quality=100&sign=95171912&sv=1)
Now, if we preview the output, you can see that for each country name from the source table, the List Lookup has returned a corresponding code value.
![](https://documentation.astera.com/~gitbook/image?url=https%3A%2F%2F3891069449-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F28dJIkGHacXhBlux3efx%252Fuploads%252F8knGE8ldOq5Qmqe1A5zp%252F17.png%3Falt%3Dmedia%26token%3Ddd21dbe2-f269-4df8-a15f-31531e852717&width=768&dpr=4&quality=100&sign=dd820191&sv=1)
These CountryCodes will flow through the annotated output port if you want to write your data to a destination.
![](https://documentation.astera.com/~gitbook/image?url=https%3A%2F%2F3891069449-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F28dJIkGHacXhBlux3efx%252Fuploads%252F4IXRkbi7SS2szvMexw9P%252F14.png%3Falt%3Dmedia%26token%3D45961798-be28-4a7c-8fff-0f96032af593&width=768&dpr=4&quality=100&sign=b36aa283&sv=1)
This is how we can map the lookup values to a target or a transformation in the dataflow using the output port.
![](https://documentation.astera.com/~gitbook/image?url=https%3A%2F%2F3891069449-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F28dJIkGHacXhBlux3efx%252Fuploads%252FwDwTNvjppHyCdGukRtAB%252F15.png%3Falt%3Dmedia%26token%3Db4a20bd6-b2d0-487b-b34f-4f647efe3dd3&width=768&dpr=4&quality=100&sign=fbee7036&sv=1)
This concludes using the List Lookup transformation object in Astera Data Stack.
Last updated