data-transformation Scenario 1 — Extract Prices, Remove Currency, Cast to Float, Export CSV
Written by RTILA X Engineering Team
Beginner ~4 min
What You'll Learn
Transform scraped data using replace and cast
Real-World Use Case
Normalising prices before export
LIVE DEMO
Price Normalization
Raw currency strings transformed into floating point values.
| Product Name | Raw Price |
|---|---|
| Wireless Mouse | $299.99 |
| Mechanical Keyboard | €149.50 |
| USB-C Hub | $89.00 |
| Bluetooth Speaker | £199.99 |
| Webcam | $45.99 |
| 4K Monitor | $1,299.00 |
| Standing Desk | $75.50 |
| Laptop Stand | $549.99 |
EXPECTED OUTPUT
Normalized Prices
| name | price |
|---|---|
| Wireless Mouse | 299.99 |
| Mechanical Keyboard | 149.5 |
| USB-C Hub | 89 |
| Bluetooth Speaker | 199.99 |
| Webcam | 45.99 |
| 4K Monitor | 1299 |
| Standing Desk | 75.5 |
| Laptop Stand | 549.99 |
RTILA X PROJECT JSON
RTILA X Automation Project
normalize-prices-export.json
{
"name": "Normalize_Prices_And_Export",
"settings": {
"urls": [
"https://learn.rtila.com/scenarios/data-transformation/1"
]
},
"datasets": {
"normalized_prices": {
"item_selector": "css=table.price-table tbody tr",
"properties": [
{
"name": "name",
"type": "text",
"selector": "css=td:nth-child(1)"
},
{
"name": "price",
"type": "text",
"selector": "css=td:nth-child(2)",
"transformations": [
{
"type": "script",
"code": "return parseFloat(String(value).replace(/[^0-9.]/g, '')) || 0;",
"default_value": 0
}
]
}
]
}
},
"commands": [
{
"command": "extract_data",
"params": {
"dataset": "normalized_prices"
}
},
{
"command": "comment",
"params": {
"text": "CSV export would occur in the trigger chain after extraction"
}
}
]
} Transformations are applied at the dataset property level. The replace operation removes currency symbols, and the cast operation converts the string to a float for CSV export.
Did you complete this scenario?
Ready to run this automation?
Copy the project JSON above, open RTILA X, create a new project, and paste it.
This scenario covers 1 RTILA X command and is referenced in 2 learning articles.
Continue Learning
Was this helpful?
Thank you for your feedback!