The Restructure node can be used to generate multiple fields based on the values of a nominal or flag field. The newly generated fields can contain values from another field or numeric flags (0 and 1). The functionality of this node is similar to that of the Set to Flag node. However, it offers more flexibility. It allows you to create fields of any type (including numeric flags), using the values from another field. You can then perform aggregation or other manipulations with other nodes downstream. (The Set to Flag node lets you aggregate fields in one step, which may be convenient if you are creating flag fields.)
For example, the following dataset contains a nominal field,
Account, with the values
opening balance and current balance are recorded for each account, and some customers have multiple
accounts of each type. Let's say you want to know whether each customer has a particular account
type, and if so, how much money is in each account type. You use the Restructure node to generate a
field for each of the
Account values, and you select
Current_Balance as the value. Each new field is populated with the current balance
for the given record.
Using the Restructure node with the Aggregate node
In many cases, you may want to pair the Restructure node with an Aggregate
node. In the previous example, one customer (with the ID 12703) has three accounts. You can use an
Aggregate node to calculate the total balance for each account type. The key field is
CustID, and the aggregate fields are the new restructured fields,
following table shows the results.