Icon

Challenge 13 - Onsite and Online Transactions - Solution

Onsite and Online Transactions

Your company keeps data related to online and onsite transactions in a tabular dataset with the following format:

Index Online Onsite

1 A.6777-01

2 7736-01

3 L-2210341175-00-000020

4 L-3210341175-00-000020

5 F5454

6 B_7736-01-00-000020

7 F5454 7736-01

In this challenge, you are asked to extract digits from the transactions (which are related to the bought products) given the following guidelines: (1) if the onsite transaction starts with “L”, then take its first 12 digits; otherwise, take its first 6 digits; and (2) if the onsite transaction has a missing value, then take the string from the online transaction.

What is the most efficient way to perform this task? For the example above, you should produce the following output column:

Product Codes

677701

773601

221034117500

221034117500

F5454

773601

773601

Your boss gives you data from two different sources he found: Online Transaction and Onsite Transaction. Index Online Transaction Onsite Transaction1 A.6777-012 7736-013 L-2210341175-00-0000204 L-3210341175-00-0000205 F5454 6 B_7736-01-00-0000207 F5454 7736-01In this challenge you will extract digits given the following guidelines: 1. Take the first 6 digits (numbers) from Onsite Transaction. 2. If Onsite Transaction starts with “L”, then take the first 12 digits. 3. If Onsite Transaction has a missing value, then take the string from Online Transaction.What is the most efficient way to perform this task and produce the following output column: output 677701 773601 221034117500 221034117500 F5454 773601 773601
Table Creator
remove intermediatecolumns
Column Filter
p_missing
Rule Engine
extract numbers
String Manipulation
generate output column
Column Merger
javascript if-else statement
Column Expressions

Nodes

Extensions

Links