SharePoint: os valores calculados da coluna desaparecem ao editar o item da lista. Alguma ideia?

StackOverflow https://stackoverflow.com/questions/1094628

  •  11-09-2019
  •  | 
  •  

Pergunta

Eu tenho uma coluna calculada em uma lista personalizada do SharePoint 2007, com a seguinte fórmula:

=CONCATENATE("IR-",[ID],"-",LEFT(UPPER([Title]),25))

Se um item for criado na lista, está tudo bem, no entanto, quando um item é atualizado, a coluna [id] não estará mais na coluna calculada para esse item.

Então, na criação: "IR-40-TETITLEISHERE", mas depois de editar, é "Ir-TheTleishere".

Alguém tem algumas dicas sobre por que isso estaria acontecendo?

Foi útil?

Solução

Eu confirmo o comportamento mencionado acima. Qualquer add/editar limpará a parte [id]. Se você editar a coluna na lista e atualizar a fórmula, ela atualizará todos os itens da lista a estar correto (até que você faça uma edição no item).

eu encontrei Este post que menciona o mesmo problema.

Parece que a única solução seria criar um fluxo de trabalho simples usando o SharePoint Designer que atualizaria um campo de texto em sua lista.

Outras dicas

I had an issue similar a while back. Through other blogs and experts, I discovered that the [ID] column should not be used in a calculated column because it wreaks havoc and causes many errors. Sorry - remove the ID column and you should be fine.

This question is a little old, but I had the same issue and found a solution for it. It is a pretty specific fix and won't help everyone -- it involves using javascript in a content editor web part to update the calculated field.

This site -- http://blog.pathtosharepoint.com/2008/09/01/using-calculated-columns-to-write-html/ -- gives an example of how to use javascript in the same manner that I used it.. the important block of code is the first while loop. The point is to grab the out of box ID column from the list and update whatever calculated field needs the ID.

In my case I had a URL in a calculated field that required the ID as a parameter.. of course that wouldn't work normally because you can't put the ID in a calculated field. What I did was I put "?ID=null" in the ID parameter of my calculated field's url, I then replaced that with the ID that was retrieved using javascript.. so whenever the page is loaded, the js kicks off and updates all of the URLs to have the correct ID.

I know this is very old but I couldn't find a newer version of the question anywhere else and the answer above from ferr solved the problem for me but isn't very clear so I thought I'd update it.

This assumes that you want to use the ID in the output HTML (for example within a link), I think this is fairly common.

Using the javascript from the pathtosharepoint link I added in the following to get the id with an if statement for safety:

if (HTMLregexp.test(CellContent)) {    //original pathtosharepoint line
   if (NodeSet[i].parentNode.getAttribute("iid")){
      var SPID = NodeSet[i].parentNode.getAttribute("iid").split(",")[1];
      CellContent = CellContent.replace("SPIDReplace", SPID)
   }
NodeSet[i].innerHTML = CellContent;   //original pathtosharepoint line

This is put in the while loop of the latest pathtosharepoint fix at time of writing. This works for me on SharePoint 2010. Note: Include the string "SPIDReplace" in your calculated column to get it replaced by the item ID.

pathtosharepoint page: http://blog.pathtosharepoint.com/category/calculated-columns/ pathtosharepoint code: http://pathtosharepoint.com/Downloads

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top