Sharepoint列格式-基本

问题描述 投票:0回答:1

我有一个非常基本的共享点列表,其中包含3列,如下所示:

Date1 |日期2 | CalculatedDateDif(获取两个日期之间的月份)01/01/2018 | 2018年1月3日| 201/01/2018 | 01/04/2018 | 3

我正在使用默认的microsoft JSON code格式化CalculatedDateDif列以显示错误图标,当值小于或等于2时!下方:

{
  "$schema": "http://columnformatting.sharepointpnp.com/columnFormattingSchema.json",
  "debugMode": true,
  "elmType": "div",
  "attributes": {
    "class": "=if(@currentField <= 2,'sp-field-severity--warning', '')"
  },
  "children": [
    {
      "elmType": "span",
      "style": {
        "display": "inline-block",
        "padding": "0 4px"
      },
      "attributes": {
        "iconName": "=if(@currentField <= 2,'Error', '')"
      }
    },
    {
      "elmType": "span",
      "txtContent": "@currentField"
    }
  ]
}

出于某种奇怪的原因,它格式化计算列下的所有行,并从计算列中删除值。

我尝试用@CalculatedDateDif替换@currentField,但没有好运。

我正在在线使用Sharepoint。

json sharepoint formatting sharepoint-online
1个回答
0
投票

转到列表设置,然后编辑CalculatedDateDif列,选择此公式返回的数据类型为单行文本,然后将其保存。

enter image description here

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.