Set types without failing when an optional column is missing (bike rental)
A Changed Type step that lists Discount breaks when an export has no Discount column. Type only the columns that are present.
- Level
- advanced
- Time
- ~10 min
- Task
- Build the query
- Access
- Pro
Checking your access…
About this exercise
What you'll practise
Build a type-transformation list from the columns that actually exist.
The scenario, sample data, step list, hints and solution open with Pro. Grading checks your query against hidden data as well as the visible sample, so a query that only fits the sample doesn't pass.
Input
- OrderFile (file)
- Text file; first line: OrderID,Customer,Qty,UnitPrice,Discount
- Every field is text until you set types
Expected output columns
OrderID (text), Customer (text), Qty (number), UnitPrice (number), Discount (number)