AgentSkillsCN

powerAutomateUtility

Power Automate 与 Azure Logic Apps 表达式函数参考。当您需要处理 Logic Apps 或 Power Automate 工作流表达式时,可使用此技能,涵盖字符串、集合、数学、日期、URI、数据操作以及逻辑函数。

SKILL.md
--- frontmatter
name: powerAutomateUtility
description: Power Automate and Azure Logic Apps expression functions reference. Use this skill when working with Logic Apps or Power Automate workflow expressions, including string, collection, math, date, URI, manipulation, and logical functions.

Power Automate & Azure Logic Apps Expression Functions Reference

This document provides a complete reference for expression functions available in Azure Logic Apps and Power Automate workflow expressions.

Expression Syntax

  • Functions in expressions: @{functionName(parameter)}
  • Nested functions: @{outerFunction(innerFunction(parameter))}
  • Property access: @{functionName(parameter).propertyName}
  • Interpolated format (inline with text): text @{functionName(parameter)} text
  • Parameters are evaluated left to right
  • A ? after a parameter means it is optional

String Functions

FunctionSignatureDescription
chunkchunk('<text>', <length>)Split a string into chunks of equal length
concatconcat('<text1>', '<text2>', ...)Combine two or more strings. Max result: 104,857,600 chars
endsWithendsWith('<text>', '<searchText>')Check if string ends with substring (case-insensitive)
formatNumberformatNumber(<number>, '<format>', '<locale>'?)Format a number as a string
guidguid('<format>'?)Generate a GUID. Formats: "N", "D" (default), "B", "P", "X"
indexOfindexOf('<text>', '<searchText>')Return starting position of substring (case-insensitive, 0-based). Returns -1 if not found
isFloatisFloat('<string>', '<locale>'?)Check if string is a floating-point number
isIntisInt('<string>')Check if string is an integer
lastIndexOflastIndexOf('<text>', '<searchText>')Return position of last occurrence of substring (case-insensitive, 0-based)
lengthlength('<collection>')Return number of items in string or array
nthIndexOfnthIndexOf('<text>', '<searchText>', <occurrence>)Return position of nth occurrence of substring. Negative occurrence searches from end
replacereplace('<text>', '<oldText>', '<newText>')Replace substring (case-sensitive)
sliceslice('<text>', <startIndex>, <endIndex>?)Return substring by start/end position. Supports negative indices
splitsplit('<text>', '<delimiter>')Split string into array by delimiter
startsWithstartsWith('<text>', '<searchText>')Check if string starts with substring (case-insensitive)
substringsubstring('<text>', <startIndex>, <length>?)Return characters from specified position (0-based). startIndex + length must be <= string length
toLowertoLower('<text>')Convert to lowercase
toUppertoUpper('<text>')Convert to uppercase
trimtrim('<text>')Remove leading and trailing whitespace

Collection Functions

FunctionSignatureDescription
chunkchunk([<collection>], <length>)Split array into chunks of equal length
containscontains('<collection>', '<value>')Check if collection has specific item (case-sensitive)
emptyempty('<collection>')Check if collection is empty
firstfirst('<collection>')Return first item
intersectionintersection([<coll1>], [<coll2>], ...)Return only common items across collections
itemitem()Return current item in a repeating action over an array
joinjoin([<collection>], '<delimiter>')Join array items with delimiter. Max result: 104,857,600 chars
lastlast('<collection>')Return last item
lengthlength([<collection>])Return number of items
reversereverse([<collection>])Reverse order of items
skipskip([<collection>], <count>)Remove items from front, return rest
sortsort([<collection>], '<sortBy>'?)Sort items. Optional key for object sorting
taketake('<collection>', <count>)Return items from front
unionunion([<coll1>], [<coll2>], ...)Return all items from all collections (no duplicates)

Logical Comparison Functions

Note: null values are converted to empty string ("") in comparisons.

FunctionSignatureDescription
andand(<expr1>, <expr2>, ...)True if all expressions are true
equalsequals(<object1>, <object2>)True if both values are equivalent
greatergreater(<value>, <compareTo>)True if first > second
greaterOrEqualsgreaterOrEquals(<value>, <compareTo>)True if first >= second
ifif(<expression>, <valueIfTrue>, <valueIfFalse>)Return value based on boolean expression
lessless(<value>, <compareTo>)True if first < second
lessOrEqualslessOrEquals(<value>, <compareTo>)True if first <= second
notnot(<expression>)True if expression is false
oror(<expr1>, <expr2>, ...)True if at least one expression is true

Conversion Functions

FunctionSignatureDescription
arrayarray('<value>')Return array from single input
base64base64('<value>')Return base64-encoded string
base64ToBinarybase64ToBinary('<value>')Return binary from base64 string
base64ToStringbase64ToString('<value>')Decode base64 string
binarybinary('<value>')Return base64-encoded binary of string
boolbool(<value>)Return boolean version of value
createArraycreateArray('<obj1>', '<obj2>', ...)Return array from multiple inputs
dataUridataUri('<value>')Return data URI for string
dataUriToBinarydataUriToBinary('<value>')Return binary from data URI
dataUriToStringdataUriToString('<value>')Return string from data URI
decimaldecimal('<value>')Return decimal number from string. Wrap with string() to preserve precision
decodeBase64decodeBase64('<value>')Deprecated - use base64ToString()
decodeDataUridecodeDataUri('<value>')Return binary from data URI. Prefer dataUriToBinary()
decodeUriComponentdecodeUriComponent('<value>')Decode escape characters in string
encodeUriComponentencodeUriComponent('<value>')Encode URL-unsafe characters. Prefer uriComponent()
floatfloat('<value>', '<locale>'?)Convert string to float. Supports locale-specific formats
intint('<value>')Convert string to integer
jsonjson('<value>')Convert string or XML to JSON
stringstring(<value>)Convert value to string. Null becomes empty string ("")
uriComponenturiComponent('<value>')URI-encode a string
uriComponentToBinaryuriComponentToBinary('<value>')Return binary from URI-encoded string
uriComponentToStringuriComponentToString('<value>')Decode URI-encoded string
xmlxml('<value>')Convert string/JSON to XML. JSON must have single root property

Math Functions

FunctionSignatureDescription
addadd(<summand1>, <summand2>)Add two numbers
divdiv(<dividend>, <divisor>)Divide two numbers (integer division). Divisor cannot be 0
maxmax(<num1>, <num2>, ...) or max([<array>])Return highest value
minmin(<num1>, <num2>, ...) or min([<array>])Return lowest value
modmod(<dividend>, <divisor>)Return remainder. Result sign matches dividend
mulmul(<multiplicand1>, <multiplicand2>)Multiply two numbers
randrand(<minValue>, <maxValue>)Random integer, inclusive at start, exclusive at end
rangerange(<startIndex>, <count>)Return integer array. Count must be <= 100,000
subsub(<minuend>, <subtrahend>)Subtract second from first

Date and Time Functions

Default timestamp format: "o" (yyyy-MM-ddTHH:mm:ss.fffffffK) - ISO 8601. Time unit values: "Second", "Minute", "Hour", "Day", "Week", "Month", "Year".

FunctionSignatureDescription
addDaysaddDays('<timestamp>', <days>, '<format>'?)Add days to timestamp
addHoursaddHours('<timestamp>', <hours>, '<format>'?)Add hours to timestamp
addMinutesaddMinutes('<timestamp>', <minutes>, '<format>'?)Add minutes to timestamp
addSecondsaddSeconds('<timestamp>', <seconds>, '<format>'?)Add seconds to timestamp
addToTimeaddToTime('<timestamp>', <interval>, '<timeUnit>', '<format>'?)Add time units to timestamp
convertFromUtcconvertFromUtc('<timestamp>', '<destTimeZone>', '<format>'?)Convert from UTC to target time zone
convertTimeZoneconvertTimeZone('<timestamp>', '<sourceTimeZone>', '<destTimeZone>', '<format>'?)Convert between time zones
convertToUtcconvertToUtc('<timestamp>', '<sourceTimeZone>', '<format>'?)Convert to UTC
dateDifferencedateDifference('<startDate>', '<endDate>')Return difference as timespan string
dayOfMonthdayOfMonth('<timestamp>')Return day of month (integer)
dayOfWeekdayOfWeek('<timestamp>')Return day of week (0=Sunday, 1=Monday, ...)
dayOfYeardayOfYear('<timestamp>')Return day of year (integer)
formatDateTimeformatDateTime('<timestamp>', '<format>'?, '<locale>'?)Format a timestamp
getFutureTimegetFutureTime(<interval>, '<timeUnit>', '<format>'?)Current timestamp + time units
getPastTimegetPastTime(<interval>, '<timeUnit>', '<format>'?)Current timestamp - time units
parseDateTimeparseDateTime('<timestamp>', '<locale>'?, '<format>'?)Parse timestamp string to ISO 8601
startOfDaystartOfDay('<timestamp>', '<format>'?)Return start of day
startOfHourstartOfHour('<timestamp>', '<format>'?)Return start of hour
startOfMonthstartOfMonth('<timestamp>', '<format>'?)Return start of month
subtractFromTimesubtractFromTime('<timestamp>', <interval>, '<timeUnit>', '<format>'?)Subtract time units from timestamp
ticksticks('<timestamp>')Return ticks (100-nanosecond intervals since 0001-01-01)
utcNowutcNow('<format>'?)Return current timestamp

Workflow Functions

FunctionSignatureDescription
actionaction()Return current action's output at runtime
actionsactions('<actionName>')Return named action's output at runtime
bodybody('<actionName>')Return action's body output. Shorthand for actions('<actionName>').outputs.body
formDataMultiValuesformDataMultiValues('<actionName>', '<key>')Return array of values matching key in form-data output
formDataValueformDataValue('<actionName>', '<key>')Return single value matching key in form-data output
itemitem()Current item in repeating action over array
itemsitems('<loopName>')Current item from each cycle in for-each loop
iterationIndexesiterationIndexes('<loopName>')Index value for current iteration in Until loop
listCallbackUrllistCallbackUrl()Return callback URL for trigger/action (HttpWebhook and ApiConnectionWebhook only)
multipartBodymultipartBody('<actionName>', <index>)Return body for specific part in multipart output
outputsoutputs('<actionName>')Return action's output at runtime
parametersparameters('<parameterName>')Return value for workflow parameter
resultresult('<scopedActionName>')Return results from top-level actions in scoped action (For_each, Until, Scope)
triggertrigger()Return trigger output at runtime
triggerBodytriggerBody()Return trigger's body output. Shorthand for trigger().outputs.body
triggerFormDataMultiValuestriggerFormDataMultiValues('<key>')Return array of values matching key in trigger form-data
triggerFormDataValuetriggerFormDataValue('<key>')Return single value matching key in trigger form-data
triggerMultipartBodytriggerMultipartBody(<index>)Return body for specific part in trigger multipart output
triggerOutputstriggerOutputs()Return trigger output. Shorthand for trigger().outputs
variablesvariables('<variableName>')Return value of specified variable
workflowworkflow().<property>Return workflow details. Properties: name, type, id, location, run, tags

URI Parsing Functions

FunctionSignatureDescription
uriHosturiHost('<uri>')Return host value
uriPathuriPath('<uri>')Return path value
uriPathAndQueryuriPathAndQuery('<uri>')Return path and query values
uriPorturiPort('<uri>')Return port value
uriQueryuriQuery('<uri>')Return query value
uriSchemeuriScheme('<uri>')Return scheme value

JSON & XML Manipulation Functions

FunctionSignatureDescription
addPropertyaddProperty(<object>, '<property>', <value>)Add property to JSON object. Fails if property exists
coalescecoalesce(<obj1>, <obj2>, ...)Return first non-null value
removePropertyremoveProperty(<object>, '<property>')Remove property from JSON object
setPropertysetProperty(<object>, '<property>', <value>)Set property value on JSON object
xpathxpath('<xml>', '<xpath>')Find XML nodes/values matching XPath expression

Key Behaviors

  • Case sensitivity: contains, replace are case-sensitive. indexOf, lastIndexOf, startsWith, endsWith are case-insensitive.
  • Null handling: In logical comparisons, null values become empty strings (""). string(null) returns "".
  • Base64: Azure Logic Apps auto-performs base64 encoding/decoding - manual conversion usually unnecessary.
  • div() behavior: Integer division when both operands are integers; float result if either operand is float.
  • mod() sign: Result sign matches the dividend sign.
  • Time zones: Use Windows time zone names (e.g., "Pacific Standard Time").
  • Format strings: Use .NET format specifiers for dates and numbers.