[{"id":"cf9e6fa8-0b86-49e2-ac68-07594c7af412","tags":[{"product":null,"links":null,"id":"ba7e818e-4f6b-4211-b1ac-58e3bafcf439","name":"\u66F4\u65B0","color":"orange","productId":"0995490e-43fc-4d6e-bc8d-8e66f38b0c63"}]},{"id":"d3324a01-b600-4674-8aee-dac1f6640ec9","tags":[{"product":null,"links":null,"id":"ba7e818e-4f6b-4211-b1ac-58e3bafcf439","name":"\u66F4\u65B0","color":"orange","productId":"0995490e-43fc-4d6e-bc8d-8e66f38b0c63"}]},{"id":"3e247fcf-cdb2-4f60-a969-1498a5bfdb2d","tags":[{"product":null,"links":null,"id":"adf72f47-7f61-4239-8392-b9bcc127fa80","name":"\u65B0\u589E","color":"green","productId":"0995490e-43fc-4d6e-bc8d-8e66f38b0c63"}]},{"id":"f8fae864-8593-4474-a823-ae63aa34f17c","tags":[{"product":null,"links":null,"id":"adf72f47-7f61-4239-8392-b9bcc127fa80","name":"\u65B0\u589E","color":"green","productId":"0995490e-43fc-4d6e-bc8d-8e66f38b0c63"}]},{"id":"931caca9-ac3f-4fb9-bd21-c561b8f4c131","tags":[{"product":null,"links":null,"id":"ba7e818e-4f6b-4211-b1ac-58e3bafcf439","name":"\u66F4\u65B0","color":"orange","productId":"0995490e-43fc-4d6e-bc8d-8e66f38b0c63"}]},{"id":"31b37c80-894c-4ddb-8445-0ddb77116ebf","tags":[{"product":null,"links":null,"id":"adf72f47-7f61-4239-8392-b9bcc127fa80","name":"\u65B0\u589E","color":"green","productId":"0995490e-43fc-4d6e-bc8d-8e66f38b0c63"}]},{"id":"7827c267-c18d-4225-a98a-69abc788f00d","tags":[{"product":null,"links":null,"id":"ba7e818e-4f6b-4211-b1ac-58e3bafcf439","name":"\u66F4\u65B0","color":"orange","productId":"0995490e-43fc-4d6e-bc8d-8e66f38b0c63"}]},{"id":"75958fc3-b020-4620-a44c-34e00d53c6ab","tags":[{"product":null,"links":null,"id":"ba7e818e-4f6b-4211-b1ac-58e3bafcf439","name":"\u66F4\u65B0","color":"orange","productId":"0995490e-43fc-4d6e-bc8d-8e66f38b0c63"}]},{"id":"8cdb3b7d-dca1-4490-bebc-d8faa2998eb4","tags":[{"product":null,"links":null,"id":"ba7e818e-4f6b-4211-b1ac-58e3bafcf439","name":"\u66F4\u65B0","color":"orange","productId":"0995490e-43fc-4d6e-bc8d-8e66f38b0c63"}]},{"id":"94d72550-4999-4422-aaa0-0a149d42e4fd","tags":[{"product":null,"links":null,"id":"ba7e818e-4f6b-4211-b1ac-58e3bafcf439","name":"\u66F4\u65B0","color":"orange","productId":"0995490e-43fc-4d6e-bc8d-8e66f38b0c63"}]},{"id":"087e3f2a-f18d-4838-a51d-1d98539c8b0f","tags":[{"product":null,"links":null,"id":"adf72f47-7f61-4239-8392-b9bcc127fa80","name":"\u65B0\u589E","color":"green","productId":"0995490e-43fc-4d6e-bc8d-8e66f38b0c63"}]},{"id":"0d8daadd-44fb-4e7d-bfae-d7e3c494fbdc","tags":[{"product":null,"links":null,"id":"adf72f47-7f61-4239-8392-b9bcc127fa80","name":"\u65B0\u589E","color":"green","productId":"0995490e-43fc-4d6e-bc8d-8e66f38b0c63"}]},{"id":"4100a562-8227-463d-8cd7-a86c028c7980","tags":[{"product":null,"links":null,"id":"ba7e818e-4f6b-4211-b1ac-58e3bafcf439","name":"\u66F4\u65B0","color":"orange","productId":"0995490e-43fc-4d6e-bc8d-8e66f38b0c63"}]},{"id":"967ee563-9ecf-44e2-99a4-e91fe8dbc722","tags":[{"product":null,"links":null,"id":"ba7e818e-4f6b-4211-b1ac-58e3bafcf439","name":"\u66F4\u65B0","color":"orange","productId":"0995490e-43fc-4d6e-bc8d-8e66f38b0c63"}]},{"id":"ad4c4887-a925-4aa3-a65c-6988bbc71603","tags":[{"product":null,"links":null,"id":"adf72f47-7f61-4239-8392-b9bcc127fa80","name":"\u65B0\u589E","color":"green","productId":"0995490e-43fc-4d6e-bc8d-8e66f38b0c63"}]},{"id":"282ed04c-5f92-4348-a82e-125448d5c70e","tags":[{"product":null,"links":null,"id":"ba7e818e-4f6b-4211-b1ac-58e3bafcf439","name":"\u66F4\u65B0","color":"orange","productId":"0995490e-43fc-4d6e-bc8d-8e66f38b0c63"}]},{"id":"3ca1ce65-7f2e-4b1b-8846-361962f50ed0","tags":[{"product":null,"links":null,"id":"ba7e818e-4f6b-4211-b1ac-58e3bafcf439","name":"\u66F4\u65B0","color":"orange","productId":"0995490e-43fc-4d6e-bc8d-8e66f38b0c63"}]},{"id":"e1fb1b27-6f94-4100-bb0e-7b43d63781eb","tags":[{"product":null,"links":null,"id":"ba7e818e-4f6b-4211-b1ac-58e3bafcf439","name":"\u66F4\u65B0","color":"orange","productId":"0995490e-43fc-4d6e-bc8d-8e66f38b0c63"}]},{"id":"9a39e982-c66b-489e-b0e1-bfa1bcd15a70","tags":[{"product":null,"links":null,"id":"adf72f47-7f61-4239-8392-b9bcc127fa80","name":"\u65B0\u589E","color":"green","productId":"0995490e-43fc-4d6e-bc8d-8e66f38b0c63"}]},{"id":"274f82b6-deda-49dc-8487-95028b51195c","tags":[{"product":null,"links":null,"id":"ba7e818e-4f6b-4211-b1ac-58e3bafcf439","name":"\u66F4\u65B0","color":"orange","productId":"0995490e-43fc-4d6e-bc8d-8e66f38b0c63"}]},{"id":"5c518362-9fbf-484c-80ef-72d2ec815c2d","tags":[{"product":null,"links":null,"id":"adf72f47-7f61-4239-8392-b9bcc127fa80","name":"\u65B0\u589E","color":"green","productId":"0995490e-43fc-4d6e-bc8d-8e66f38b0c63"}]},{"id":"53d6e6ad-c925-491c-9faa-0f374d8904e0","tags":[{"product":null,"links":null,"id":"ba7e818e-4f6b-4211-b1ac-58e3bafcf439","name":"\u66F4\u65B0","color":"orange","productId":"0995490e-43fc-4d6e-bc8d-8e66f38b0c63"}]},{"id":"1d5eb6c4-41cd-4121-8273-c8555932ed35","tags":[{"product":null,"links":null,"id":"adf72f47-7f61-4239-8392-b9bcc127fa80","name":"\u65B0\u589E","color":"green","productId":"0995490e-43fc-4d6e-bc8d-8e66f38b0c63"}]},{"id":"7e47a724-c7be-464b-bf41-6c8844499cd1","tags":[{"product":null,"links":null,"id":"ba7e818e-4f6b-4211-b1ac-58e3bafcf439","name":"\u66F4\u65B0","color":"orange","productId":"0995490e-43fc-4d6e-bc8d-8e66f38b0c63"}]},{"id":"207aa98c-0f41-4b44-95a5-cd18c154c79d","tags":[{"product":null,"links":null,"id":"adf72f47-7f61-4239-8392-b9bcc127fa80","name":"\u65B0\u589E","color":"green","productId":"0995490e-43fc-4d6e-bc8d-8e66f38b0c63"}]},{"id":"b033909b-d5a9-448e-9238-a044d0c6c062","tags":[{"product":null,"links":null,"id":"adf72f47-7f61-4239-8392-b9bcc127fa80","name":"\u65B0\u589E","color":"green","productId":"0995490e-43fc-4d6e-bc8d-8e66f38b0c63"}]},{"id":"9478d8b4-6bd7-4049-ad88-54593e69123c","tags":[{"product":null,"links":null,"id":"adf72f47-7f61-4239-8392-b9bcc127fa80","name":"\u65B0\u589E","color":"green","productId":"0995490e-43fc-4d6e-bc8d-8e66f38b0c63"}]},{"id":"beb379f4-f287-49b1-9c9b-a396e6c04a2d","tags":[{"product":null,"links":null,"id":"ba7e818e-4f6b-4211-b1ac-58e3bafcf439","name":"\u66F4\u65B0","color":"orange","productId":"0995490e-43fc-4d6e-bc8d-8e66f38b0c63"}]},{"id":"3f2daab3-114b-41f3-916f-b2df9f377634","tags":[{"product":null,"links":null,"id":"adf72f47-7f61-4239-8392-b9bcc127fa80","name":"\u65B0\u589E","color":"green","productId":"0995490e-43fc-4d6e-bc8d-8e66f38b0c63"}]},{"id":"240b019b-37c2-4426-a9ca-d4e57d48ffec","tags":[{"product":null,"links":null,"id":"ba7e818e-4f6b-4211-b1ac-58e3bafcf439","name":"\u66F4\u65B0","color":"orange","productId":"0995490e-43fc-4d6e-bc8d-8e66f38b0c63"}]},{"id":"6d91ce8c-1454-408b-b42a-f13ed34d7741","tags":[{"product":null,"links":null,"id":"ba7e818e-4f6b-4211-b1ac-58e3bafcf439","name":"\u66F4\u65B0","color":"orange","productId":"0995490e-43fc-4d6e-bc8d-8e66f38b0c63"}]},{"id":"b947ca15-7493-455f-834b-f1bddb015cde","tags":[{"product":null,"links":null,"id":"adf72f47-7f61-4239-8392-b9bcc127fa80","name":"\u65B0\u589E","color":"green","productId":"0995490e-43fc-4d6e-bc8d-8e66f38b0c63"}]},{"id":"bca11f89-3090-45c9-8730-9d2bfe3d8533","tags":[{"product":null,"links":null,"id":"adf72f47-7f61-4239-8392-b9bcc127fa80","name":"\u65B0\u589E","color":"green","productId":"0995490e-43fc-4d6e-bc8d-8e66f38b0c63"}]},{"id":"8a50b408-80ee-443d-a2d6-ba6d4e0cff64","tags":[{"product":null,"links":null,"id":"adf72f47-7f61-4239-8392-b9bcc127fa80","name":"\u65B0\u589E","color":"green","productId":"0995490e-43fc-4d6e-bc8d-8e66f38b0c63"}]},{"id":"2928a65c-9eb7-4566-947d-dcd1b964242a","tags":[{"product":null,"links":null,"id":"adf72f47-7f61-4239-8392-b9bcc127fa80","name":"\u65B0\u589E","color":"green","productId":"0995490e-43fc-4d6e-bc8d-8e66f38b0c63"}]},{"id":"dac60248-5749-4548-96c1-5ac67b63dfba","tags":[{"product":null,"links":null,"id":"ba7e818e-4f6b-4211-b1ac-58e3bafcf439","name":"\u66F4\u65B0","color":"orange","productId":"0995490e-43fc-4d6e-bc8d-8e66f38b0c63"}]},{"id":"30d4007d-ac66-497f-b333-92fbf155f379","tags":[{"product":null,"links":null,"id":"adf72f47-7f61-4239-8392-b9bcc127fa80","name":"\u65B0\u589E","color":"green","productId":"0995490e-43fc-4d6e-bc8d-8e66f38b0c63"}]},{"id":"7243b1bf-b870-4199-a0d9-accf339eaf9a","tags":[{"product":null,"links":null,"id":"adf72f47-7f61-4239-8392-b9bcc127fa80","name":"\u65B0\u589E","color":"green","productId":"0995490e-43fc-4d6e-bc8d-8e66f38b0c63"}]},{"id":"de71aa3e-78f6-412f-99eb-b89cde8a0cb7","tags":[{"product":null,"links":null,"id":"ba7e818e-4f6b-4211-b1ac-58e3bafcf439","name":"\u66F4\u65B0","color":"orange","productId":"0995490e-43fc-4d6e-bc8d-8e66f38b0c63"}]},{"id":"1245bac8-b2d7-4bb7-a0d4-ca10152819f3","tags":[{"product":null,"links":null,"id":"adf72f47-7f61-4239-8392-b9bcc127fa80","name":"\u65B0\u589E","color":"green","productId":"0995490e-43fc-4d6e-bc8d-8e66f38b0c63"}]},{"id":"76f3c859-c392-44dc-af32-6003bfe33fe2","tags":[{"product":null,"links":null,"id":"ba7e818e-4f6b-4211-b1ac-58e3bafcf439","name":"\u66F4\u65B0","color":"orange","productId":"0995490e-43fc-4d6e-bc8d-8e66f38b0c63"}]},{"id":"de23f283-0ab0-44f4-bb22-5a3771cd5366","tags":[{"product":null,"links":null,"id":"ba7e818e-4f6b-4211-b1ac-58e3bafcf439","name":"\u66F4\u65B0","color":"orange","productId":"0995490e-43fc-4d6e-bc8d-8e66f38b0c63"}]},{"id":"8cde5af9-f36a-4bc2-a396-76735b77adfc","tags":[{"product":null,"links":null,"id":"adf72f47-7f61-4239-8392-b9bcc127fa80","name":"\u65B0\u589E","color":"green","productId":"0995490e-43fc-4d6e-bc8d-8e66f38b0c63"}]},{"id":"3ff57337-c9a3-4afe-971e-a2ffa073d412","tags":[{"product":null,"links":null,"id":"adf72f47-7f61-4239-8392-b9bcc127fa80","name":"\u65B0\u589E","color":"green","productId":"0995490e-43fc-4d6e-bc8d-8e66f38b0c63"}]},{"id":"395b26ec-782f-447c-b558-d565b399ac81","tags":[{"product":null,"links":null,"id":"ba7e818e-4f6b-4211-b1ac-58e3bafcf439","name":"\u66F4\u65B0","color":"orange","productId":"0995490e-43fc-4d6e-bc8d-8e66f38b0c63"}]},{"id":"4690b659-1897-49d5-8743-adc5eb02d41f","tags":[{"product":null,"links":null,"id":"adf72f47-7f61-4239-8392-b9bcc127fa80","name":"\u65B0\u589E","color":"green","productId":"0995490e-43fc-4d6e-bc8d-8e66f38b0c63"}]},{"id":"b35f451b-a8e4-41ec-a686-a940d1c62271","tags":[{"product":null,"links":null,"id":"ba7e818e-4f6b-4211-b1ac-58e3bafcf439","name":"\u66F4\u65B0","color":"orange","productId":"0995490e-43fc-4d6e-bc8d-8e66f38b0c63"}]},{"id":"041092ab-8521-4e42-9a41-094038252b05","tags":[{"product":null,"links":null,"id":"adf72f47-7f61-4239-8392-b9bcc127fa80","name":"\u65B0\u589E","color":"green","productId":"0995490e-43fc-4d6e-bc8d-8e66f38b0c63"}]},{"id":"6f87b8ff-da60-4307-af0a-8e73170cfc0c","tags":[{"product":null,"links":null,"id":"adf72f47-7f61-4239-8392-b9bcc127fa80","name":"\u65B0\u589E","color":"green","productId":"0995490e-43fc-4d6e-bc8d-8e66f38b0c63"}]},{"id":"cb06d0d4-32e7-4c71-a53a-9885cbe10ce5","tags":[{"product":null,"links":null,"id":"ba7e818e-4f6b-4211-b1ac-58e3bafcf439","name":"\u66F4\u65B0","color":"orange","productId":"0995490e-43fc-4d6e-bc8d-8e66f38b0c63"}]},{"id":"36611fc3-508f-430b-a33b-86ffb4b2c1c9","tags":[{"product":null,"links":null,"id":"ba7e818e-4f6b-4211-b1ac-58e3bafcf439","name":"\u66F4\u65B0","color":"orange","productId":"0995490e-43fc-4d6e-bc8d-8e66f38b0c63"}]},{"id":"e5514e63-4aaa-456c-9c76-b462ddc4a85c","tags":[{"product":null,"links":null,"id":"adf72f47-7f61-4239-8392-b9bcc127fa80","name":"\u65B0\u589E","color":"green","productId":"0995490e-43fc-4d6e-bc8d-8e66f38b0c63"}]},{"id":"9e8b8e90-de25-49a0-abb4-551bc5ea9e64","tags":[{"product":null,"links":null,"id":"adf72f47-7f61-4239-8392-b9bcc127fa80","name":"\u65B0\u589E","color":"green","productId":"0995490e-43fc-4d6e-bc8d-8e66f38b0c63"}]},{"id":"6678d138-580e-4b9b-b81f-55e328061d72","tags":[{"product":null,"links":null,"id":"ba7e818e-4f6b-4211-b1ac-58e3bafcf439","name":"\u66F4\u65B0","color":"orange","productId":"0995490e-43fc-4d6e-bc8d-8e66f38b0c63"}]},{"id":"c14b681e-ebf8-4fdb-953d-ed9972772441","tags":[{"product":null,"links":null,"id":"ba7e818e-4f6b-4211-b1ac-58e3bafcf439","name":"\u66F4\u65B0","color":"orange","productId":"0995490e-43fc-4d6e-bc8d-8e66f38b0c63"}]},{"id":"b270146e-438e-43ec-a233-c509042c9600","tags":[{"product":null,"links":null,"id":"adf72f47-7f61-4239-8392-b9bcc127fa80","name":"\u65B0\u589E","color":"green","productId":"0995490e-43fc-4d6e-bc8d-8e66f38b0c63"}]}]
在仪表板中设置跳转至外部链接时,URL中可以添加多种数据信息,但添加时的格式和语法都必须满足固定要求。
本页为您详细介绍动态变量的语法要求(相关示例效果,请您参见跳转至外部链接)。
整体的表达语法要求为: #{变量内容 | 格式化}
#{} 是在URL中添加动态变量的固定用法,用来标识整个变量表达的内容。
其中大括号里的前半部分(“变量内容”)包含变量名和具体属性。这里使用 javascript 标准对象语法,使用中括号加引号 [" "] 或者圆点 . 的形式来访问对象的属性。示例: #{user["name"]} 或 #{user.name} 或者都可以用来表示 user 变量的 name 属性。
大括号里的后半部分(“| 格式化”)用于对变量的结果进行格式化,根据实际情况可省略。
比如:
在URL中使用 #{user["name"]} 或 #{user.name} 表示当前用户信息中的用户名。
当前登录用户的用户名为 Jack 的话,实际URL中 #{user["name"]} 或 #{user.name} 就会使用 Jack。
注意
推荐您使用中括号加引号[""]的形式引用对象的属性。
由于圆点 . 的形式不支持引用特殊属性名,比如属性名中包含特殊字符括号、空格、星号等时,使用圆点则引用失败。
下表中为您列出了系统 中所有可以在URL中使用的变量名称,以及应用语法。
这是表达式中应识别的第一级对象/模型:
上下文变量名称不区分大小写。
如果变量无法识别,则使用空值。
列名(columnName)区分大小写。
可用变量名(不区分大小写) | 说明 | 示例 |
---|---|---|
User | 语法:#{user["propName"]|formatter} 支持的属性:
| 动态URL:http://abc.com?p1=#{user.name} 对应的实际URL:http://abc.com?p1=Jack 动态URL:http://abc.com?p1=#{user.name|"#value"}对应的实际URL:http://abc.com?p1="Jack" 动态URL:http://abc.com?p1=#{user.roles}对应的实际URL:http://abc.com?p1=[Admin, Everyone] 动态URL:http://abc.com?p1=#{user.roles|"#value"}对应的实际URL:http://abc.com?p1=["Admin", "Everyone"] |
Document | 语法:
支持的属性:
| 当前页面URL:http://def.com?theme=black®ion=Japan 动态URL: http://abc.com?theme=#{urlParameters.theme}&salesRegion=#{urlParameters.region} 实际URL: http://abc.com?theme=black&salesRegion=Japan |
UrlParameters | 语法:#{UrlParameters["propName"]|formatter} 该属性支持当前页面URL中的所有搜索查询参数。 | |
Parameters | 语法:#{Parameters["parameterName"]|formatter} 如果参数为多值,则值类型为数组。 如果参数不是多值,则值类型为单值。 | |
Slicer | 语法:
多维列表框, 多维下拉框
标签列表
数值范围、日期范围、相对日期
| 其中slicerScenarioName来源于组件属性设置中“组件名称”。 示例中使用的即此类变量,由于报表参数值得传递要求必须添加引号,因此为变量添加了格式化。 #{Slicer.labelSlicer|"#value"} |
FilteredValue | 语法:
扩展语法:
仅对支持数据绑定的图表有效,切片器除外。 返回已被相关切片器,筛选器,钻取等过滤的特定列实际值。 | 在FilteredValue中,columnName表示列在“数据集”字段列表区域中的显示名称。 例如:数据集列的原始名称为“RegionName”,用户将其重命名为“Region”,因此动态网址应为“http://abc.com?p1”=#{filteredValue[“Region”]}“ |
Selection | 语法:
值类型为级联数值。 仅对支持数据绑定和选择的图表有效,切片器除外。 以格式化中定义的顺序返回所选的特定列值。 如果没有格式化,则仪表板将输出所有维度的值,但维度顺序是随机的。 | 选中数据点的维度字段。 维度: A, B 动态URL:http://abc.com?p1=#{selection|["DimA"]:["DimB"]} 对应实际URL:http://abc.com?p1=[A1:B1,A1:B2,A2:,A3:B4]} 动态URL:http://abc.com?p1=#{selection|["DimB"]} 对应实际URL:http://abc.com?p1=[B1,B2,B4] 动态URL:http://abc.com?p1=#{selection}对应实际URL:http://abc.com?p1=[A1:B1,A1:B2,A2:,A3:B4]}或者http://abc.com?p1=[B1:A1,B2:A1,:A2,B4:A3]} 注意: |
Datasets | 语法:
支持属性:
值类型: 单值 默认时间格式为 "yyyy-MM-DDThh:mm:ss" 注:若想取得抽取模型的最后更新时间,也使用该动态参数。 | 动态URL:http://abc.com?p1=#{dataset[sales].lastUpdated} 实际URL:http://abc.com?p1=2020-08-18T23:00:00 |
Databinding | 用于在跳转到外部系统时获取组件的底层数据。 支持三种形式: Databinding["datasetId"] Databinding["pivotModel"] Databinding["rawModel"]
用于获取非聚合数据计算 聚合数据的rawModel ,返回数据为表格数据,默认偏移量为0,限制为200,用户可以更改。 如果组件绑定了一个分析表达式的度量,该度量将在 rawModel 对象中被忽略。 | 示例一: URL:http://localhost8080?p=#{Databinding["pivotModel"]} 实际结果: 示例二: URL:http://localhost8080?p=#{Databinding["pivotModel"]}&p1=#{Databinding["rawModel"]} 实际结果: 示例三: URL:http://localhost8080?p=#{Databinding["pivotModel"]}&p1=#{Databinding["rawModel"]}&p2=#{Databinding["datasetId"]} 实际结果: |
值类型 | 格式化关键字 | 示例 | |||
---|---|---|---|---|---|
单值 | #value | 场景 | URL | 格式化 | 结果 |
p1=#{user.name} | - | p1=Jack | |||
p1=#{user.name|#value} | #value | p1=Jack | |||
p1=#{user.name|“#value”} | "#value" | p1="Jack" | |||
p1=#{user.name|"#value@grapecity.com"} | #value@grapecity.com | p1=Jack@grapecity.com | |||
数组 | #value | p1=#{user.roles} | - | p1=[Admin, Everyone] | |
p1=#{user.roles|#value} | #value | p1=[Admin, Everyone] | |||
p1=#{user.roles|“#value”} | "#value" | p1=["Admin", "Everyone"] | |||
p1=#{user.rol es|GC-#value} | GC-#value | p1=[GC-Admin, GC-Everyone] | |||
数值范围 | #value | 数值范围筛选器 Sales: 1k~2k | p1=#{Slicer["rangeSlicer"]} | - | p1=[1000, 2000] |
p1=#{Slicer["rangeSlicer"]|#value} | #value | p1=[1000, 2000] | |||
p1=#{Slicer["rangeSlicer"]|"#value"} | "#value" | p1=["1000", "2000"] | |||
级联数值 | ["columnName"] | 多维列表框筛选器维度 DimA, DimB
| p1=#{Slicer["treeSlicer"]} | - | p1=[A1:B1, A1:B2, A2:, A3:B4] |
p1=#{Slicer["treeSlicer"]|["DimA"]:["DimB"]} | ["DimA"]:["DimB"] | p1=[A1:B1, A1:B2, A2:, A3:B4] | |||
p1=#{Slicer["treeSlicer"]|"["DimA"]"~"["DimB"]"} | "["DimA"]"~"["DimB"]" | p1=["A1"~"B1", "A1"~"B2", "A2"~"", "A3"~"B4"] | |||
p1=#{Slicer["treeSlicer"]|"["DimA"]"~["DimB"]} | "["DimA"]"~["DimB"] | p1=["A1"~B1, "A1"~B2, "A2"~, "A3"~B4] | |||
p1=#{Slicer["treeSlicer"]|["DimA"]} | ["DimA"] | p1=[A1, A2, A3] | |||
p1=#{Slicer["treeSlicer"]|"["DimA"]"} | "["DimA"]" | p1=["A1", "A2", "A3"] |
type=warning
注意
当变量值未被定义或值为空时,格式化将失效,实际URL中将显示为空或“null”。
例如原始URL中为:p1=#{urlParameters.testData|“#value”}&p2=xxx
当 testData 是一个未定义的属性时,则实际URL会显示为:p1=&p2=xxx
当 testData 是一个一定义的属性,但没有值时,则实际URL会显示为:p1=null&p2=xxx
当 testData 值为3时,则实际URL会显示为:p1="3"&p2=xxx
还支持使用 $JSON$ 和 $COLLECTION$ 进行格式化。
$JSON$
语法:$JSON$
可用于单个/数组/范围值的格式化:$JSON$(dimensionName1[,dimensionName2, ...])
也可用于级联数值定义顺序,如 $JSON$("DimA","DimB")
$COLLECTION$
语法:$COLLECTION$(commonFormatterText, leftBracket, rightBracket, itemSeparator)
参数 | 说明 |
---|---|
commonFormatterText | null:表示不进行格式化 |
leftBracket | null:表示使用“[” |
rightBracket | null:表示使用“]” |
itemSeparator | null:表示使用“,” |
具体示例如下:
值类型 | 示例 | 格式化 | URL | 结果 |
---|---|---|---|---|
单值 | 1 | $JSON$ | http://abc.com?dp={"p1":#{Slicers["dataRangeSlicer"].minValue|$JSON$}} | http://abc.com?dp={"p1": [1]} |
数组 | [1,2,3] | $JSON$ | http://abc.com?dp={"p1":#{Slicers["lableSlicer"]|$JSON$}} | http://abc.com?dp={"p1": [1,2,3]} |
数值范围 | 数值范围筛选器 Sales: 1k~2k | $JSON$ | http://abc.com?dp={"p1":#{Slicers["dataRangeSlicer"]|$JSON$}} | http://abc.com?dp={"p1": [1000,2000]} |
级联数值 | 多维列表框筛选器维度: DimA-DimB:
| $JSON$ | http://abc.com?dp={"p1":#{Slicers["treeSlicer"]|$JSON$}} | http://abc.com?dp={"p1": [["A1","B1"], ["A1","B2"], ["A2"], ["A3","B4"]]} |
$JSON$("DimA") | http://abc.com?dp={"p1":#{Slicers["treeSlicer"]|$JSON$("DimA")}} | http://abc.com?dp={"p1": ["A1","A2","A3"]} | ||
$JSON$("DimB","DimA") | http://abc.com?dp={"p1":#{Slicers["treeSlicer"]|$JSON$("DimB","DimA")}} | http://abc.com?dp={"p1": [["B1","A1"], ["B2","A1"], [null,"A2"], ["B4","A3"]]} | ||
单值 | 1 | $COLLECTION$() | http://abc.com?p1=#{Slicers["dataRangeSlicer"].minValue|$COLLECTION$()} | http://abc.com?p1=[1] |
$COLLECTION("", "<", ">") | http://abc.com?p1=#{Slicers["dataRangeSlicer"].minValue|$COLLECTION$("", "<", ">")} | http://abc.com?p1=<1> | ||
数组 | [1,2,3] | $COLLECTION$("", "", "", ";") | http://abc.com?p1=#{Slicers["labelSlicer"]|$COLLECTION$("", "", "", ";")} | http://abc.com?p1=1;2;3 |
$COLLECTION$(null, null, null, null) | http://abc.com?p1=#{Slicers["labelSlicer"]|$COLLECTION$(null, null, null, null)} | http://abc.com?p1=[1,2,3] | ||
$COLLECTION$("#value", "", "", ";") | http://abc.com?p1=#{Slicers["labelSlicer"]|$COLLECTION$("", "", "", ";")} | http://abc.com?p1=1;2;3 | ||
$COLLECTION$('"#value"', "", "", ";") | http://abc.com?p1=#{Slicers["labelSlicer"]|$COLLECTION$('"#value"', "", "", ";")}} | http://abc.com?p1="1";"2";"3" | ||
级联数值 | 多维列表框筛选器维度: DimA-DimB:
| $COLLECTION$() | http://abc.com?p1=#{Slicers["treeSlicer"]|$COLLECTION$()} | http://abc.com?p1=[A1:B1, A1:B2, A2:, A3:B4] |
$COLLECTION$('["DimA"]', "", "", ";") | http://abc.com?p1=#{Slicers["treeSlicer"]|$COLLECTION$('["DimA"]', "", "", ";")} | http://abc.com?p1=A1; A2; A3 | ||
$COLLECTION$('"["DimA"]"', "", "", ";") | http://abc.com?p1=#{Slicers["treeSlicer"]|$COLLECTION$('"["DimA"]"', "", "", ";")} | http://abc.com?p1="A1"; "A2"; "A3" | ||
$COLLECTION$('["DimB"]:["DimA"]', "", "") | http://abc.com?p1=#{Slicers["treeSlicer"]|$COLLECTION$('["DimB"]:["DimA"]', "", "")} | http://abc.com?p1=B1:A1, B2:A1, :A2, B4:A3 |
使用$FORMAT$进行自定义格式化
语法:$FORMAT$(valueExpression1, fomratString1[, valueExpression2, formatString2, ...])
valueExpression:描述应该格式化哪个值。它可以是#value或dimensionName(仅用于级联数值)。
fomratString:描述使用哪种格式模板来格式化值。支持的格式字符串列表: SpreadJS格式化字符串和Excel 格式代码指南。
type=info
与其他格式化一起使用时,需注意:
$FORMAT$() 仅通过特定的 formatString 进行格式化。
优先执行它,然后执行其他格式化。
它也可以放在其他格式化之后。具体语法为
#{Variable|$FORMAT$()}
#{Variable|formatter|$FORMAT$()}
具体示例如下:
值类型 | 实例 | 格式化 | 文本变量表达式 | 结果 |
---|---|---|---|---|
单值 | "2021-12-31T09:00:00" | $FORMAT$("#value", "yyyy年MM月dd日") | p1=#{Slicers["dateRangeSlicer"].minValue|$FORMAT$("#value", "yyyy年MM月dd日")} | p1=2021年12月31日 |
单值 | "2021-12-31T09:00:00" | $FORMAT$("#value", "yyyy年MM月dd日") "#value#" | p1=#{Slicers["dateRangeSlicer"].minValue|"#value#"|$FORMAT$("#value", "yyyy年MM月dd日")} | p1="2021年12月31日" |
数组 | ["2021-01-01T00:00:00", "2021-12-31T23:59:59"] | $FORMAT$("#value", "yyyy年MM月dd日") | p1=#{Slicers["dateRangeSlicer"]|$FORMAT$("#value", "yyyy年MM月dd日")} | p1=[2021年01月01日,2021年12月31日] |
数组 | ["2021-01-01T00:00:00", "2021-12-31T23:59:59"] | $FORMAT$("#value", "yyyy年MM月dd日") $COLLECTION("", "<", ">") | p1=#{Slicers["dateRangeSlicer"]|$COLLECTION$("", "<", ">")|$FORMAT$("#value", "yyyy年MM月dd日")} | p1=<2021年01月01日,2021年12月31日> |
级联数据 | 维度: DimA, DimB
| $FORMAT$("DimA", '', "DimB", "$#.00" ) | p1=#{Slicer["treeSlicer"]|$FORMAT$("DimA", "", "DimB", "$#.00" )} | p1=[A1:$1.00, A1:$2.00, A2, A3:$4.00] |
级联数据 | 维度: DimA, DimB
| $COLLECTION$('["DimB"]:["DimA"]', "", "") $FORMAT$("DimA", "", "DimB", "$#.00" ) | p1=#{Slicer["treeSlicer"]|$COLLECTION$('["DimB"]:["DimA"]', "", "")|$FORMAT$("DimA", "", "DimB", "$#.00" )} | p1=[$1.00:A1, $2.00:A1, :A2, $4.00:A3] |
在仪表板设计器中,用户也可以使用$FORMAT$在富文本中用来显示特定格式。
例如:
对比效果: