0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【Power BI】日本語のリスト名、列名に URL クエリ文字列パラメーターでフィルターをかける

Last updated at Posted at 2022-12-20

リスト名、列名が日本語の場合、そのままフィルター URL に使用できません。
SharePoint リストで日本語列を作った際に使われる列の內部名と同じ書式の文字列に変換する必要があります。

テーブル名と列名に含まれる特殊文字

テーブル名と列名に含まれる特殊文字とスペースには、追加の書式設定が必要です。 クエリにスペース、ダッシュ、またはその他の非 ASCII 文字を含める場合は、それらの特殊文字の前に、アンダースコアと X ( _x) で始まる "エスケープ コード" を付け、その後に 4 桁の Unicode を続け、さらにもう 1 つのアンダースコアを付加します。 Unicode が 4 文字未満の場合は、それをゼロで埋める必要があります。 次に例をいくつか示します。

URL でフィルターする場合は以下のような書式で指定します。値は日本語でも OK ですが、テーブル/フィールド の部分は、変換する必要があります。

?filter=<テーブル>/<フィールド> eq '<値>'

?filter=商品マスタ/商品名 eq 'りんご'
?filter=_x5546__x54c1__x30de__x30b9__x30bf_/_x5546__x54c1__x540d_ eq 'りんご'

変換

PowerShell で文字列を Unicode (16進数) をつなげた文字列に変換します。

$str = 'Column 商品名'
-join ($str.ToCharArray() | % {
  if ($_ -match '[a-zA-Z_0-9]') {
      $_
  } else {
      "_x{0}_" -f [convert]::ToString([int][char]$_, 16).PadLeft(4, "0")
  }
})

Column_x0020__x5546__x54c1__x540d_

参考サイト

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?