<script runat="server"> Platform.Load("Core", "1"); // Define Data Extension Names var sourceDEName = "Kp_Testing"; var targetDEName = "Processed_Products"; // Retrieve Source Data Extension var sourceDE = DataExtension.Init(sourceDEName); var rows = sourceDE.Rows.Retrieve(); // Retrieve Target Data Extension var targetDE = DataExtension.Init(targetDEName); // Loop through each row in the source Data Extension for (var i = 0; i < rows.length; i++) { var sKey = rows[i].SKey; var productID = rows[i].ProductID; // Split ProductID by comma var productValues = productID.split(','); // Loop through each product value and insert into the target Data Extension for (var j = 0; j < productValues.length; j++) { var productValue = productValues[j].trim(); // Trim whitespace // Insert each product value into the target Data Extension targetDE.Rows.Add({ SKey: sKey, ProductValue: productValue }); } } </script>
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter