Condividi tramite


Text.From

Sintassi

Text.From(value as any, optional culture as nullable text) as nullable text

Informazioni su

Restituisce la rappresentazione testuale di un valore specificato.

  • value: valore da convertire in testo. Il valore può essere un valore number, date, time, datetime, datetimezone, logical, durationo binary. Se il valore specificato è null, questa funzione restituisce null.
  • culture: (facoltativo) La cultura da usare per convertire il valore in testo (ad esempio, "en-US").

Esempio 1

Creare un valore di testo dal numero 3.

Utilizzo

Text.From(3)

Output

"3"

Esempio 2

Ottiene l'equivalente del testo della data e dell'ora specificate.

Utilizzo

Text.From(#datetime(2024, 6, 24, 14, 32, 22))

Output

"6/24/2024 2:32:22 PM"

Esempio 3

Ottiene l'equivalente del testo tedesco della data e dell'ora specificate.

Utilizzo

Text.From(#datetime(2024, 6, 24, 14, 32, 22), "de-DE")

Output

"24.06.2024 14:32:22"

Esempio 4

Ottenere un valore binario dal testo codificato come esadecimale e modificare di nuovo il valore in testo.

Utilizzo

Text.From(Binary.FromText("10FF", BinaryEncoding.Hex))

Output

"EP8="

Esempio 5

Ottieni le righe nella tabella che contengono dati per Francia e converte le date in testo usando la cultura francese.

Utilizzo

let
    Source = #table(type table [Company ID = text, Country = text, Date = date],
    {
        {"JS-464", "USA", #date(2024, 3, 24)},
        {"LT-331", "France", #date(2024, 10, 5)},
        {"XE-100", "USA", #date(2024, 5, 21)},
        {"RT-430", "Germany", #date(2024, 1,18)},
        {"LS-005", "France", #date(2023, 12, 31)},
        {"UW-220", "Germany", #date(2024, 2, 25)}
    }),
    #"Convert Dates" = Table.TransformColumns(
        Table.SelectRows(Source, each [Country] = "France"),
        {"Date", each Text.From(_, "fr-FR")}
    )
in
    #"Convert Dates"

Output

#table(type table [Company ID = text, Country = text, Date = text],
{
    {"LT-331", "France", "05/10/2024"},
    {"LS-005", "France", "31/12/2023"}
})