# Passthru Transformation

The *Passthru* Transformation object creates a new dataset based on the elements that were passed to the transformation. This is useful for organizing datasets for better readability and grouping of values that are otherwise calculated over and over again (e.g. a *Sequence Generator Transformation*).

In this document, we will learn how to use the *Passthru* Transformation object in Astera.

### Sample Use-Case

In this case, we are using an [*XML/JSON File Source*](https://documentation.astera.com/astera-data-stack-v10/dataflows/sources/xml-json-file-source)*.*

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FyUs11KAgmpYmOmVWhUZa%2F1_data.PNG?alt=media\&token=8783f890-7ff5-4a10-8202-17abad2c6732)

The source file contains customers’ information in the parent node and their order and shipping details in the collection/child node.

Preview data by right-clicking on source object’s header and select *Preview Output*.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2Fm68rHH9sUtYvGDoGGUlQ%2F2_preview.png?alt=media\&token=4ca7e458-3d11-4ba2-9da5-5ef06dab884f)

A *Data Preview* window will open, showing you the preview of the hierarchical data.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FqTEHy5WaNntysNAaOcNy%2F3_data_preview.PNG?alt=media\&token=99e1b163-ecea-4ff9-b2e3-c39db62510d2)

Now, we want to create a field in the parent node that contains the count of orders that arrived late for each customer and write these records to a destination file. This new field in the parent node will depend on two fields, *RequiredDate* and *ShippedDate*, that are already present in the collection/child node.

For this purpose, we will use the *Passthru* Transformation object.

#### Using *Passthru* Transformation

1. To get a *Passthru* Transformation object from the Toolbox,\* go to *Toolbox > Transformations > Passthru* and drag-and-drop the *Passthru* object onto the designer.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2Ff2IbhhyBr6x1H3xk3H3H%2Fpassthru_object.gif?alt=media\&token=8c710aad-4775-4680-a31d-3096e848de72)

You can see that the dragged transformation object is empty right now. This is because we have not mapped any fields to it yet.

2. Auto-map source fields to the transformation object by dragging-and-dropping the top node of the source object, *SampleData* to the top node of transformation object, *Passthru*.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FtpCtIm5NIvAvvRpABZDK%2Fpassthru_mapping.gif?alt=media\&token=1a896bd3-9d2c-4628-91bd-ab498f32755b)

Now the mapping is done. Let’s configure the *Passthru* Transformation object.

#### Configuring the Passthru Transformation Object

1. Right-click on the transformation object’s header and select *Properties* from the context menu. A configuration window for the *Passthru* Transformation object will open. The first window is the *Layout Builder* window. This is where we can create or delete fields, change their name or data types, mark any field as a variable, or attach expressions to any field.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FASJIM3SXpplfqGqvhYWA%2Fpassthru_properties.gif?alt=media\&token=de606e7d-4326-4a7a-b549-5397c0da198a)

2. Create a new field under the parent node. Let’s call it *LateOrders* and mark it as an *Output* field.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FHmU7pWLxmfMrGRUvdNSi%2F7_new_field.png?alt=media\&token=1a3397a7-f916-4019-9752-dcbc9a5d2732)

3. Click *Next*, and you will be directed to a *Layout Modifications* window.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FSxc1nUTYu7NwTrnh3Iyk%2F8_modiication.PNG?alt=media\&token=f88175cc-9366-479a-b8d8-3b4508dac6ec)

4. Select the *LateOrders* field. Here you can modify any field by applying expressions to it.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FpMvVIz4TnQGIFjzQ7T0f%2F9_options.png?alt=media\&token=665b9f07-c392-475e-9e95-13e65d1dbc35)

5. Write the expression that counts the number of late arriving orders. Click *“…”* , located next to the expression box to open the *Expression Builder* window where you can make use of Astera’s extensive library of built-in functions and expressions.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2F2jZy1IQidvaBJMAGc25y%2F10_formula.png?alt=media\&token=b0b0d7b1-01bf-472b-bd82-ed2ee2dec796)

6. Click on the *Orders* node and a panel *(Options for Collection)* will appear. These options are only available for collection nodes. This is where we will specify the rule for routing late arriving orders. Select *Route Based on Rules* and a new section for adding rules will appear on the screen.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FdWjvyfAAvm0U2cnvmUdN%2F11_route.png?alt=media\&token=421fe021-4b7b-4271-b4d6-ca4b718d701c)

7. Add a new rule by clicking on the *Add switch condition* icon

Now, write an expression to route late arriving orders and name this rule as “LateArrivals”.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2Fpf0CXBqOTdMmTSJWWe8v%2F12_rule.png?alt=media\&token=5eabbf81-45d4-4ed4-805b-bff5cbcc9f83)

8. Click *OK*. Now observe that a new collection node, *Orders\_LateArrivals*, has been added to the *Passthru* Transformation object.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FoMnuRTAzA4doG6a2Fn5F%2F13_node.png?alt=media\&token=35122f9b-e28b-4194-853a-b3dddff3c2e7)

To preview data, right-click on the header of the transformation object and select *Preview Output* from the context menu.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FIuEswuDuPrWnDTMAlbbE%2F16_preview_output.png?alt=media\&token=da6e1449-b79f-4656-9e83-71fc6b100f69)

A *Data Preview* window will open. On expanding records, you will get corresponding order details and appended details of late arriving orders.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FDxYY0MV98yAMelIlplkt%2F17_data.png?alt=media\&token=2831e175-9875-4ea6-97ff-78b85c9edf08)

To store the output for late arriving orders, write it to a destination file.

9. Right-click on the collection node, *Orders\_LateArrivals,* and go to *Write to > Excel Workbook Destination*. An [*Excel Workbook Destination*](https://documentation.astera.com/astera-data-stack-v10/dataflows/destinations/excel-workbook-destination) object will be added to the dataflow designer with auto-mapped fields from the collection field.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FqUu7JoIEBzbeEOTLy1kx%2Fpassthru_destination.gif?alt=media\&token=8e2a9b74-ebc4-4e33-b69b-bbf2e733f146)

10. Configure settings for *Excel Workbook Destination* object.
11. Click on the *Start Dataflow* icon located in the toolbar at the top of the designer window to create the destination file.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FxVOyG9Met6DeFx0qKUUn%2F18_start_dataflow.png?alt=media\&token=afc8d8fe-1883-45dc-b7cf-bdfddb23e212)

Upon clicking this icon, an excel file will successfully be created. You can find the link to this file in the *Job progress* window.
