Forum Discussion

Isidro_ISIAN's avatar
Isidro_ISIAN
Copper Contributor
Jan 24, 2022

Format column json works fine in date column in document library EXCEPT first item

Hi community, and thanks in advance for your help.

I have a date column in a document library with this json format:

 

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
  "elmType": "div",
  "style": {
    "text-align": "=if(indexOf(toLowerCase('[$ContentType]'),'expediente banco') != -1, 'center','')"
  },
  "txtContent": "=if(indexOf(toLowerCase('[$ContentType]'),'expediente banco') != -1, '-----No Aplica en Expedientes-----','=toLocaleDateString(@currentField)')",
  "attributes": {
    "class": "=if(indexOf(toLowerCase('[$ContentType]'),'expediente banco') != -1, 'ms-fontColor-grey','')"
  }
}

 

It works fine except with the first item of the document library shown in any view. For example:

Sometimes, if I refresh the browser page this first item shows the correct date, but generally, it always shows the json formula rather thant te actual '@currentField'. The issue only occurs with the first item. 


Why is happening this odd behaviour? 
Any suggestions to fix-work around?

 

Thanks!

 

No RepliesBe the first to reply

Resources