设置变量



为您的变量添加一个值:
{{Score}} + 5
计算变量的总和:
{{Score}} + {{Answer}}
将变量相乘:
{{Score}} * {{Multiplier}}
计算百分比:
{{Score}} * 100 / {{Max Score}}
从全名中提取名字
{{Full name}}.split(' ')[0]
将现有变量转换为大写或小写:
{{Name}}.toUpperCase()
{{Name}}.toLowerCase()
这也可以是 Javascript 代码。它将读取代码的返回值并将其设置为您的变量。
const name = 'John' + 'Smith'
return name
如果您不提供return
关键字,那么它将自动添加到代码的开头
'John' + 'Smith'
return 'John' + 'Smith'
Result ID(结果ID)
这将使用当前Result ID设置您的变量。它可以被视为当前聊天用户的用户 ID。
Map item with same index(具有相同索引的映射项)
这是一个方便的设置,它允许您轻松地从一个列表中获取与另一个列表中具有相同索引的项。
当您从另一个服务提取数据时,有时会有两个列表:标签和id。标签是显示给用户的数据,id是用于对该外部服务的其他请求的数据。
该值块允许您从具有与标签中Label相同索引的Id中查找Id


Get user’s geo location(获取用的的地理位置)
您可以提供以下自定义代码:
function getLocation() {
return new Promise((resolve) => {
navigator.geolocation.getCurrentPosition(
(position) =>
resolve(`${position.coords.latitude}, ${position.coords.longitude}`),
(error) => resolve('error'),
{ enableHighAccuracy: true, timeout: 5000 }
)
})
}
const coords = await getLocation()
// Check for error
if (coords === 'error') {
return 'Unable to get location'
}
return coords

最后更新于
这有帮助吗?