Manipulating strings, dates, and numbers
π₯ Mastering String, Date, and Number Manipulation in Power Automate
π Introduction: Why Manipulating Strings, Dates, and Numbers Matters in Power Automate
Include the keyword: manipulating strings, dates, and numbers in Power Automate
Explain that transforming and working with data is essential for:
- Creating dynamic content (e.g., emails, files, reports)
- Formatting timestamps and user inputs
- Calculating values and performing conditional logic
- Interfacing with external systems that require strict data formats
π§΅ String Manipulation in Power Automate
H2: Common Use Cases for String Manipulation
H3: Real-World Examples
- Extract names from emails
- Format file names dynamically
- Trim user input
- Combine fields in reports
H3: Most Used String Functions
concat()
substring()
replace()
trim()
toLower()
,toUpper()
split()
length()
indexOf()
Use tables with syntax, description, and examples.
π Date and Time Functions in Power Automate
H2: Real-World Use Cases for Date Manipulation
H3: Examples
- Schedule reminders
- Calculate due dates
- Format dates for APIs
- Display friendly timestamps in emails
H3: Powerful Date Functions
utcNow()
addDays()
,addHours()
formatDateTime()
ticks()
startOfDay()
,endOfDay()
subtractFromTime()
Include common patterns like calculating expiry dates, last day of month, and creating time windows.
π’ Number Manipulation in Power Automate
H2: Use Cases for Numeric Data Handling
H3: Common Scenarios
- Totals in loops
- Currency calculations
- Threshold comparisons
- Converting strings to numbers
H3: Core Number Functions
add()
,sub()
,mul()
,div()
int()
,float()
mod()
rand()
π§ͺ Combining String, Date, and Number Logic
H3: Examples
- βReminder: Your invoice of ${{amount}} is due on {{formatDateTime(dueDate)}}β
- Generate file name:
concat('Invoice_', triggerOutputs()?['InvoiceID'], '_', formatDateTime(utcNow(), 'yyyyMMdd'))
- Calculate days until deadline:
sub(ticks(dueDate), ticks(utcNow()))
π§ Advanced Tips and Gotchas
- Handle nulls using
coalesce()
orif(empty())
- Watch out for timezone mismatches
- Use
int()
when looping with numeric comparisons - Combine expressions in Compose for readability
β Best Practices
- Always test edge cases (empty, null, special characters)
- Use Compose for complex expressions
- Name actions clearly
- Group similar logic into scopes for clarity