訓練
模組
Author a basic formula that uses tables and records in a Power Apps canvas app - Training
Learn how to author a basic formula that uses tables and records in a Power Apps canvas app.
Table.ReplaceValue(table as table, oldValue as any, newValue as any, replacer as function, columnsToSearch as list) as table
在 oldValue
的指定資料行中,以 newValue
取代 table
。
以資料行 B 中的「world」取代文字「goodbye」,僅比對整個值。
使用方式
Table.ReplaceValue(
Table.FromRecords({
[A = 1, B = "hello"],
[A = 2, B = "goodbye"],
[A = 3, B = "goodbyes"]
}),
"goodbye",
"world",
Replacer.ReplaceValue,
{"B"}
)
輸出
Table.FromRecords({
[A = 1, B = "hello"],
[A = 2, B = "world"],
[A = 3, B = "goodbyes"]
})
以資料行 B 中的「or」取代文字「ur」,比對值的任何部分。
使用方式
Table.ReplaceValue(
Table.FromRecords({
[A = 1, B = "hello"],
[A = 2, B = "wurld"]
}),
"ur",
"or",
Replacer.ReplaceText,
{"B"}
)
輸出
Table.FromRecords({
[A = 1, B = "hello"],
[A = 2, B = "world"]
})
匿名美國員工的名稱。
使用方式
Table.ReplaceValue(
Table.FromRecords({
[Name = "Cindy", Country = "US"],
[Name = "Bob", Country = "CA"]
}),
each if [Country] = "US" then [Name] else false,
each Text.Repeat("*", Text.Length([Name])),
Replacer.ReplaceValue,
{"Name"}
)
輸出
Table.FromRecords({
[Name = "*****", Country = "US"],
[Name = "Bob", Country = "CA"]
})
匿名美國員工的所有資料行。
使用方式
Table.ReplaceValue(
Table.FromRecords({
[Name = "Cindy", Country = "US"],
[Name = "Bob", Country = "CA"]
}),
each [Country] = "US",
"?",
(currentValue, isUS, replacementValue) =>
if isUS then
Text.Repeat(replacementValue, Text.Length(currentValue))
else
currentValue,
{"Name", "Country"}
)
輸出
Table.FromRecords({
[Name = "?????", Country = "??"],
[Name = "Bob", Country = "CA"]
})
訓練
模組
Author a basic formula that uses tables and records in a Power Apps canvas app - Training
Learn how to author a basic formula that uses tables and records in a Power Apps canvas app.