利用Power Automate将SharePoint list中对应列的‘FY20’替换为‘FY’,程序结构如下:
- 用Get items获取要替换的表格,并搜索要替换的内容。其中,在site address输入此list所在网址,List Name为表格的名称。点开Show all,在Filter query里用substringof函数搜索要替换的内容,在top count输入要搜索的数据行数,默认值是100。
substringof 函数搜索指定列的值,用法:SUBSTRINGOF( '{string to check}', {Col to query} )
2. 添加Apply to each动作,在‘选择上一步的输出’里选择表格内容。
3. 在For each内部添加SharePoint的Update item,替换文本。其中Id为表格每条数据的识别符,在对应栏(图中为Year,也为'field_1')用concat函数将修改后的文本连接起来。
concat('FY',substring(item()?['field_1'],sub(length(item()?['field_1']),2),2))
concat函数将字符串连接起来,用法:CONCAT([string1],...,[stringN])
substring函数截取字符串中指定的字符,用法:SUBSTRING([string],[start],[count])
sub函数返回两个数字之差,用法:SUB(minuend, subtrahend)
length函数返回字符或矩阵的长度,用法:LENGTH(collection)