Not
Bu sayfaya erişim yetkilendirme gerektiriyor. Oturum açmayı veya dizinleri değiştirmeyi deneyebilirsiniz.
Bu sayfaya erişim yetkilendirme gerektiriyor. Dizinleri değiştirmeyi deneyebilirsiniz.
Sözdizimi
Table.ReplaceValue(
table as table,
oldValue as any,
newValue as any,
replacer as function,
columnsToSearch as list
) as table
Hakkında
Bir değeri tablonun belirtilen sütunlarında yeni bir değerle değiştirir.
-
table: Aranacak tablo. -
oldValue: Değiştirilecek değer. -
newValue: Değiştirme değeri. -
replacer: Kullanılacak değiştirici fonksiyonu. İşlev, özgün metni yeni metinle değiştirmek, Replacer.ReplaceText özgün değeri yeni bir değerle değiştirmek veya özel bir değiştirici olabilirReplacer.ReplaceValue. -
columnsToSearch: Değiştirecek değeri aramak için tablodaki belirli sütunu veya sütunları içeren liste.
Örnek 1
"Goodbye" metnini B sütunundaki "world" ile değiştirerek yalnızca değerin tamamını eşleştirin.
Kullanım
Table.ReplaceValue(
Table.FromRecords({
[A = 1, B = "hello"],
[A = 2, B = "goodbye"],
[A = 3, B = "goodbyes"]
}),
"goodbye",
"world",
Replacer.ReplaceValue,
{"B"}
)
Çıktı
Table.FromRecords({
[A = 1, B = "hello"],
[A = 2, B = "world"],
[A = 3, B = "goodbyes"]
})
Örnek 2
B sütununda bulunan metindeki "ur" kısmını "or" ile değiştirerek değerin herhangi bir bölümünü eşleştirin.
Kullanım
Table.ReplaceValue(
Table.FromRecords({
[A = 1, B = "hello"],
[A = 2, B = "wurld"]
}),
"ur",
"or",
Replacer.ReplaceText,
{"B"}
)
Çıktı
Table.FromRecords({
[A = 1, B = "hello"],
[A = 2, B = "world"]
})
Örnek 3
ABD çalışanlarının adlarını anonimleştirin.
Kullanım
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"}
)
Çıktı
Table.FromRecords({
[Name = "*****", Country = "US"],
[Name = "Bob", Country = "CA"]
})
Örnek 4
ABD çalışanlarının tüm sütunlarını anonimleştirin.
Kullanım
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"}
)
Çıktı
Table.FromRecords({
[Name = "?????", Country = "??"],
[Name = "Bob", Country = "CA"]
})