当状态更改为完成时,需要一个公式使%完成列为100% [英] Need a formula to make % completed column to be 100% when Status changed to Complete

查看:105
本文介绍了当状态更改为完成时,需要一个公式使%完成列为100%的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello

有没有人知道我可以放入状态栏(已启动,未启动等)或%完成列的公式,以便在状态时列已更改为"完成",它会自动将%完成更改为100?

Does anyone know of a formula that I can put in either the status column (started, not started, etc) or % Complete column so that when the status column is changed to "Complete", it automatically changes % complete to 100?

这适用于Sharepoint 2016在线

This is really for Sharepoint 2016 online

谢谢

推荐答案

默认情况下,在SharePoint任务列表中,任务状态和完成百分比是相关的,由代码隐藏控制。

保存任务项目时:


  • 如果将任务状态设置为未启动,则%Complete将自动设置为0.
  • 如果您将任务状态设置为已完成,则%Complete将自动设置为100.
  • 如果您是任务状态为任何其他值,%Complete将自动设置为50。
  • 如果将%Complete设置为0,则任务状态将设置为未启动自动。
  • 如果将%Complete设置为100,则任务状态将自动设置为已完成。
  • 如果您将%Complete设置为任何其他数字(0 <0。价值< 100),任务状态将自动设置为进行中。
  • If you set the Task Status to Not Started, % Complete will be set to 0 automatically.
  • If you set the Task Status to Completed, % Complete will be set to 100 automatically.
  • If you set the Task Status to any other value, % Complete will be set to 50 automatically.
  • If you set the % Complete to 0, the Task Status will be set to Not Started automatically.
  • If you set the % Complete to 100, the Task Status will be set to Completed automatically.
  • If you set the % Complete to any other number (0< value < 100), the Task Status will be set to In Progress automatically.

如果您使用自定义列表,则需要使用JavaScript将
%的值设置为完成状态时完成为100。

这是一个演示:

<script src="https://code.jquery.com/jquery-1.10.2.min.js" type="text/javascript"></script>

<script language="javascript" type="text/javascript">

function PreSaveItem(){

                // get "Task Status" field value

                var status=


(" select [title ='Task Status']选项:selected")。text();

if(status ==" Completed"){
("select[title='Task Status'] option:selected").text(); if(status == "Completed"){


('input [title ="%Complete"]')。val(100);

}

返回true;
}
< / script>
('input[title="% Complete"]').val(100); } return true; } </script>





最好的问候,

Linda


这篇关于当状态更改为完成时,需要一个公式使%完成列为100%的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆