亚洲欧洲∨国产一区二区三区动漫网, 久久国产精品亚洲国产成人蜜臀av, chinese国产外卖体育生gv, 成 人 h动 漫网站hd在线播放,2021国产不卡精品午夜,xsav性色无码免费,一级做a爰片欧美激情一级,二次元美女被捆绑用震蛋折磨,欧美诱人大屁股18p

Skip to content

表達式 ?

此功能允許你根據(jù)以下數(shù)據(jù)為塊設(shè)置動態(tài)值:

名稱描述訪問項目
獲取數(shù)據(jù) table
變量變量獲取數(shù)據(jù) variables.<variableName>
循環(huán)數(shù)據(jù)獲取循環(huán)數(shù)據(jù)塊的當前迭代數(shù)據(jù)loopData.<loopId>
獲取上一個區(qū)塊的數(shù)據(jù)獲取上一個區(qū)塊的數(shù)據(jù)prevBlockData
全局數(shù)據(jù)獲取工作流程全局數(shù)據(jù)globalData
獲取活動標簽頁url獲取活動標簽頁 urlactiveTabUrl
工作流程獲取調(diào)用子流程塊已執(zhí)行的工作流的數(shù)據(jù)(變量)workflow.<executeId>

MakAgent 使用 模板并使用上面的數(shù)據(jù)和函數(shù)對其進行擴展。

書寫表達式 ?

要編寫表達式,必須遵循以下格式“{{keyword }}”; 并將“關(guān)鍵字”替換為上述數(shù)據(jù)源之一。 它允許 MakAgent 區(qū)分靜態(tài)和動態(tài)數(shù)據(jù)。

假設(shè)你在工作流程中有一個變量,變量名稱是“socials”; 它的值是一個對象數(shù)組。 你想要使用 HTTP 請求塊 將此變量發(fā)送到 API。

json
[
  { "name": "GitHub", "url": "https://github.com/" },
  { "name": "Gitee", "url": "https://gitee.com/" },
  { "name": "MakWing", "url": "https://makwing.com" }
]
[
  { "name": "GitHub", "url": "https://github.com/" },
  { "name": "Gitee", "url": "https://gitee.com/" },
  { "name": "MakWing", "url": "https://makwing.com" }
]

你可以在 HTTP 請求塊 正文中使用以下表達式:

{{variables.socials}}
{{variables.socials}}

HTTP 請求塊體

但是,如果你想使用數(shù)組第一個元素上的“url”屬性作為 新標簽頁塊 URL 內(nèi)的值,該怎么辦? 為此,請使用以下表達式:

{{variables.socials.0.url}}
{{variables.socials.0.url}}

新標簽頁 URL

該表達式中的“0”表示數(shù)組的第一個元素。 如果你想獲取數(shù)組的第二個元素,請將其替換為“1”。 2 代表第三個元素; 3 代表第四個元素; 等等。

訪問表達式內(nèi)的其他數(shù)據(jù) ?

要訪問表達式內(nèi)的其他數(shù)據(jù),必須使用方括號 ([]) 將用于訪問數(shù)據(jù)的表達式括起來。 例如,當你想要使用 $increment 函數(shù)遞增變量或根據(jù)循環(huán)的當前索引獲取表行時。 你可以編寫如下表達式:

{{$increment([variables.variableName]}}

{{table.[loopData.loopId.$index].columnName}}
{{$increment([variables.variableName]}}

{{table.[loopData.loopId.$index].columnName}}

函數(shù) ?

所有內(nèi)置函數(shù)始終以前綴“$”開頭; 例如,$funcName(param); 以下是MakAgent 中可用函數(shù)的參考列表。

$date(date, dateFormat?) ?

獲取或格式化日期。 該函數(shù)有兩個參數(shù),其中第二個參數(shù)是可選的。

如果你想格式化當前日期,可以直接傳遞 dateFormat 作為第一個參數(shù),如 {{ $date('DD-MMMM-YYYY') }},以及 輸出將為“14-January-2022”。 在 day.js 頁面 上查看所有可用的日期格式。

對于 date參數(shù),請參閱 MDN 頁面 上的有效日期格式。

示例

js
$date("DD MMMM YYYY") // 14 January 2022
$date("DD-MM-YYYY, hh:mm A")  // 14-01-2022, 02:24 PM
$date("relative") // A few seconds ago
$date("timestamp") // 1651118110948

$date("2005-06-07", "DD MMMM YYYY") // 07 June 2005
$date("1977-04-01T14:00:30", "DD-MM-YYYY, hh:mm A")  // 01-04-1977, 02:00 PM
$date("14 January 2021", "relative") // A year ago
$date("14 January 2021", "timestamp") // 1610553600000
$date("DD MMMM YYYY") // 14 January 2022
$date("DD-MM-YYYY, hh:mm A")  // 14-01-2022, 02:24 PM
$date("relative") // A few seconds ago
$date("timestamp") // 1651118110948

$date("2005-06-07", "DD MMMM YYYY") // 07 June 2005
$date("1977-04-01T14:00:30", "DD-MM-YYYY, hh:mm A")  // 01-04-1977, 02:00 PM
$date("14 January 2021", "relative") // A year ago
$date("14 January 2021", "timestamp") // 1610553600000

$randint(min?, max?) ?

生成一個隨機數(shù)。 你可以通過輸入minmax 參數(shù)來更改隨機數(shù)的范圍。

示例

js
$randint() // 30
$randint() // 14

$randint(0, 10) // 4
$randint(0, 10) // 7
$randint() // 30
$randint() // 14

$randint(0, 10) // 4
$randint(0, 10) // 7

$getLength(str) ?

獲取字符串或數(shù)組的長度。

示例

js
// Get the length of a string
$getLength("testing") // 7

// Get tabel length
$getLength([table]) // 14

// Get the length of the "text" column on the second row
$getLength([table.1.text]) // 5
// Get the length of a string
$getLength("testing") // 7

// Get tabel length
$getLength([table]) // 14

// Get the length of the "text" column on the second row
$getLength([table.1.text]) // 5

$randData(expression) ?

生成隨機數(shù)據(jù)的函數(shù),只需將表達式傳遞給其參數(shù)即可。 例如,$randData("?l")將生成一個隨機小寫字母,如a。 支持的表達式:

  • ?l: lowercase
  • ?u: uppercase
  • ?d: digit
  • ?f: uppercase + lowercase
  • ?s: symbol
  • ?m: uppercase + digit
  • ?n: lowercase + digit
  • ?a: any

你還可以組合這些表達式,例如$randData("?u?l?l?l?l?d?d@gmail.com"),這將生成`Apond89@gmail。

示例

js
$randData("?d?d") // 89

$randData("?l?l?l?d?d@gmail.com") // wal29@gmail.com

$randData("?d?u?s?l?l?s?a?m") // 4C%ee^MF9
$randData("?d?d") // 89

$randData("?l?l?l?d?d@gmail.com") // wal29@gmail.com

$randData("?d?u?s?l?l?s?a?m") // 4C%ee^MF9

$multiply(value, multiplyBy) ?

用于乘以一個值。

示例

js
$multiply(5, 2) // 10

// Multiply a variable
$multiply([variables.variableName], 0.3) //20.7
$multiply(5, 2) // 10

// Multiply a variable
$multiply([variables.variableName], 0.3) //20.7

$increment(value, incrementBy) ?

用于增加一個值。

示例

js
$increment(10, 2) // 12

$increment(72, 2) // 74
$increment(10, 2) // 12

$increment(72, 2) // 74

$divide(value, incrementBy) ?

用于除以一個值。

示例

js
$divide(22, 7) // 3.142857142857143

$divide(10, 2) // 5
$divide(22, 7) // 3.142857142857143

$divide(10, 2) // 5

$subtract(value, incrementBy) ?

用于減去一個值。

示例

js
$subtract(80, 7) // 73

$subtract(11, 2) // 9
$subtract(80, 7) // 73

$subtract(11, 2) // 9

$replace(value, search, replace) ?

用于替換字符串,從要替換的字符串的值中搜索。

示例

js
$replace("hello world!", "world", "everyone") // hello everyone!

$replace("hello world!", "hello", "hi") // hi world!
$replace("hello world!", "world", "everyone") // hello everyone!

$replace("hello world!", "hello", "hi") // hi world!

$replaceAll(value, search, replace) ?

用于替換從要替換字符串的值中搜索的所有匹配字符串。

示例

js
$replace("hello world!", "o", "0") // hell0 w0rld

$replace("The temperature is 25 degrees today", " ", "") // Thetemperatureis25degreestoday
$replace("hello world!", "o", "0") // hell0 w0rld

$replace("The temperature is 25 degrees today", " ", "") // Thetemperatureis25degreestoday

$toLowerCase(value) ?

用于小寫值。

示例

js
$toLowerCase("HELLO WORLD!") // hello world!

$toLowerCase("hELLO wORLD!") // hello world!
$toLowerCase("HELLO WORLD!") // hello world!

$toLowerCase("hELLO wORLD!") // hello world!

$toUpperCase(value) ?

用于將值大寫。

示例

js
$toUpperCase("hello world!") // HELLO WORLD!

$toUpperCase("hELLO wORLD!") // HELLO WORLD!
$toUpperCase("hello world!") // HELLO WORLD!

$toUpperCase("hELLO wORLD!") // HELLO WORLD!

$modulo(num, divisor) ?

返回除法的余數(shù)或有符號余數(shù)。

示例

js
$modulo(13, 5) // 3

$modulo(-13, 5) // -3

$modulo(4, 2) // 0

$modulo(-4, 2) // -0
$modulo(13, 5) // 3

$modulo(-13, 5) // -3

$modulo(4, 2) // 0

$modulo(-4, 2) // -0

$filter(data, syntax) ?

過濾/查詢 javascript 對象。 MakAgent 使用 JSONPath 庫進行查詢。

示例

使用以下值查詢“colors”變量:

json
[
	{ color: "red", value: "#f00" },
	{ color: "green", value: "#0f0" },
	{ color: "blue", value: "#00f" },
	{ color: "cyan", value: "#0ff" },
	{ color: "magenta", value: "#f0f" },
	{ color: "yellow", value: "#ff0" },
	{ color: "black", value: "#000" }
]
[
	{ color: "red", value: "#f00" },
	{ color: "green", value: "#0f0" },
	{ color: "blue", value: "#00f" },
	{ color: "cyan", value: "#0ff" },
	{ color: "magenta", value: "#f0f" },
	{ color: "yellow", value: "#ff0" },
	{ color: "black", value: "#000" }
]
js
{{ $filter([variables.colors], "$..color") }}
// ['red', 'green', 'blue', 'cyan', 'magenta', 'yellow', 'black']

{{ $filter([variables.colors], "$..value") }}
// ['#f00', '#0f0', '#00f', '#0ff', '#f0f', '#ff0', '#000']
{{ $filter([variables.colors], "$..color") }}
// ['red', 'green', 'blue', 'cyan', 'magenta', 'yellow', 'black']

{{ $filter([variables.colors], "$..value") }}
// ['#f00', '#0f0', '#00f', '#0ff', '#f0f', '#ff0', '#000']

使用 JS 表達式

js
!!{{ $filter(variables.colors, "$..color") }}
// ['red', 'green', 'blue', 'cyan', 'magenta', 'yellow', 'black']

!!{{ $filter(variables.colors, "$..value") }}
// ['#f00', '#0f0', '#00f', '#0ff', '#f0f', '#ff0', '#000']
!!{{ $filter(variables.colors, "$..color") }}
// ['red', 'green', 'blue', 'cyan', 'magenta', 'yellow', 'black']

!!{{ $filter(variables.colors, "$..value") }}
// ['#f00', '#0f0', '#00f', '#0ff', '#f0f', '#ff0', '#000']

$stringify(value) ?

將 JavaScript 值轉(zhuǎn)換為 JSON 字符串。

示例 ?

本節(jié)提供了有關(guān)如何編寫表達式的更多示例。 以及源數(shù)據(jù)的數(shù)據(jù)結(jié)構(gòu)。

表格 ?

該表存儲為對象數(shù)組,其中表列作為對象鍵。

json
[
  { "color": "blue", "value": "#00f" },
  { "color": "cyan", "value": "#0ff" },
  { "color": "magenta", "value": "#f0f" },
  { "color": "yellow", "value": "#ff0" },
  { "color": "black", "value": "#000" }
]
[
  { "color": "blue", "value": "#00f" },
  { "color": "cyan", "value": "#0ff" },
  { "color": "magenta", "value": "#f0f" },
  { "color": "yellow", "value": "#ff0" },
  { "color": "black", "value": "#000" }
]
  • 獲取表格的第一行。
    表達式:{{ table.0 }}
    輸出:{“color”:“blue”,“value”:“#00f”}

  • 獲取表格的第二行。
    表達式:{{ table.1 }}
    輸出:{“color”:“cyan”,“value”:“#0ff”}

  • 獲取表格的最后一行。
    表達式:{{ table.$last }}
    輸出:{“color”:“black”,“value”:“#000”}

  • 獲取表格第一行顏色列的值。
    表達式:{{ table.0.color }}
    輸出:“blue”

  • 獲取表第一行value列的值。
    表達式:{{ table.0.value }}
    輸出:#00f

變量 ?

變量存儲為對象,變量名作為對象鍵。

json
{
  "url": "https://makwing.com",
  "numbers": [100, 500, 300, 200, 400]
}
{
  "url": "https://makwing.com",
  "numbers": [100, 500, 300, 200, 400]
}
  • 獲取url變量的值。
    表達式:{{ Variables.url }}
    輸出:https://makwing.com

  • 獲取numbers變量的值。
    表達式:{{ Variables.numbers }}
    輸出:[100, 500, 300, 200, 400]

  • 獲取numbers變量的第一個數(shù)字。
    表達式:{{variables.numbers.0 }}
    輸出:100

JavaScript 表達式 ?

MakAgent 還支持表達式中的 javascript,但要編寫 javascript,你必須添加 !! 字符作為塊的文本字段上的第一個值。 例如,從 數(shù)字為:{{variables.number}}!!數(shù)字為:{{variables.number}}。

JavaScript 表達式

并且你可以像使用 javascript 函數(shù)一樣使用內(nèi)置函數(shù)。

示例

  • 使用內(nèi)置函數(shù)
js
{{$getLength(table)}} //10

{{$randData("?d?d")}} // 89
{{$getLength(table)}} //10

{{$randData("?d?d")}} // 89
  • 獲取表的最后一行
js
{{table[table.length - 1].columnName}}
{{table[table.length - 1].columnName}}
  • 獲取當前時間戳
js
{{Date.now()}} //1666237704022
{{Date.now()}} //1666237704022
  • 訪問循環(huán)數(shù)據(jù)和索引
js
// Loop data
{{loopData.loopId.data}}

// Loop index
{{loopData.loopId.$index}}
// Loop data
{{loopData.loopId.data}}

// Loop index
{{loopData.loopId.$index}}