Calculated fields in Sharepoint list view
Hi,
I have to add a calculated field with formula as
if the difference between 2 date fields is 0 then i have to add todays date-modifed date.
how to achieve this in sharepoint list view/column ?
Aruna
Hi Aruna,
SharePoint doesn't allow you to use the[Today] function
in a calculated column, but there are other work around for this.Please find below link for this.
http://abstractspaces.wordpress.com/2008/05/19/use-today-and-me-in-calculated-column/
Regards
Soni K
Similar Messages
-
Creating auto-increment field in SharePoint List
In SharePoint, we can create the auto-incremental field by many ways, I am going to discuss two ways of doing it.
Calculated field
Item Event Receiver
1. Using Calculated field:
Using this we can accomplish it without doing any programing and it is a relatively simple way of doing it. By using “Calculated” column in SharePoint List we can create auto-increment field. We can accomplish this by creating a new column and choosing the
column type as “Calculated (calculation based on other columns)”. And in Formula field, we have to enter [ID]
In fact this will be using the values from “ID” field from SharePoint list that starts from 1.
For example, if we want to start our auto-increment column from 100, we can modify the “Formula” field of Create New column screen, we can have to enter [ID] + 99
For detailed info please follow the blog I wrote here: http://faisalrafique.wordpress.com/2011/03/19/creating-auto-increment-field-in-sharepoint-list/
2. Using Item Event Receiver:
By using this strategy, users have advantage to edit the existing values, we can also avoid it by making field read-only on feature activation. Using item event receiver, on ItemAdded event, we have to find the highest value among previously added items
and then save the incremented value to current newly created auto-incremental column.
For code of event reciever please follow the blog I wrote here:
http://faisalrafique.wordpress.com/2011/03/19/creating-auto-increment-field-in-sharepoint-list/
Happy CodingUse Sharepoint Designer to create a Workflow for the list containing the field to increment. For my project I had an Invoice field that I wanted to start with 1001 and increment from there so I made the following workflow to do this.
In the new workflow screen in Sharepoint Designer create two actions in Step 1:
Calculate Current Item:ID plus 1000 (Output to Variable: calc)
then Set AutoIncrementNumber to Variable: calc
This is just a guide. If you just want the auto-increment to start with 1 then you can just use this step
Set AutoIncrementNumber to Current Item:ID
Also, make sure you select the correct name for your field in the Workflow action instead of AutoIncrementNumber.
Save the Workflow, close it, and then open it again in Sharepoint Designer. Check the box for "Start workflow automatically when an item is created." Save it again and then click on the Publish button to make it active on the sharepoint site. The value should
now increment for each new item created in the list. -
Hi All,
i have date type list field in sharepoint list and i have created one form in sharepoint webpage.
Now i want to save that field from shareepoint webpage, its declared "t1.text" but its showing error.
How can i save this field?Hi AnilKarthink,
I wrote a Technet Wiki article on saving data to the various SharePoint fields. You can view it here: http://social.technet.microsoft.com/wiki/contents/articles/21801.sharepoint-a-complete-guide-to-getting-and-setting-fields-using-c.aspx
Regards, Matthew
MCPD | MCITP
My Blog
View
Matthew Yarlett's profile
See my webpart on the TechNet Gallery that allows administrative users to upload, crop and format user profile photos. Check it out here:
Upload and Crop User Profile Photos -
As per http://msdn.microsoft.com/en-us/library/ms434064.aspx if we use
list.GetItems(query, view.ID.ToString("B").ToUpper());
properties of the view that is specified by the viewName parameter override the properties that are specified in the query object that is passed through the query parameter. For example, if the query
object includes a tag that specifies only items containing a particular column value, while the view specifies to return all items, this method retrieves all of the items
So is there any way to query a sharepoint list view (not All Items) using CAML query?
I this retrieving view in a data table and query it later, which is an option but might give a performance degradation.
Regards, Aj (http://www.aj-sharepoint.blogspot.com/) MCTSHello,
Did you try with SPView.Query method? If not then this can be query to specific view.
http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spview.query.aspx
Hemendra:Yesterday is just a memory,Tomorrow we may never see
Please remember to mark the replies as answers if they help and unmark them if they provide no help -
How to add a calculated field in a list definition (schema.xml)?
Hello,
I'm currently trying to add a calculated field to a list definition (schema.xml).
I have put the following code at the end of the schema.xml for the list I want to create. But when I deploy and activate the feature for the list, it doesn't appear in the list field.
<Field ID="{EE20EC4B-4216-4259-A84F-C478CE42B70F}" Name="EC_EventsMgmt_CalculatedTime" StaticName="EC_EventsMgmt_CalculatedTime" Group="EC_EventsMgmt" Type="Calculated" DisplayName="Calculated Time" Required="TRUE" Hidden="FALSE" ReadOnly="FALSE" Format="DateTime"> <Formula>=DATE(2009,1,1)+TIME(EC_EventsMgmt_ScheduleHour,EC_EventsMgmt_ScheduleMinute,0)</Formula> <FieldRefs> <FieldRef Name="EC_EventsMgmt_ScheduleHour"/> <FieldRef Name="EC_EventsMgmt_ScheduleMinute"/> </FieldRefs> </Field>
Could you please give me some help and explain me why it is not working?
Thanks a lot.Hi there.
If I understand correctly, you create this list within the same feature?
If so, the list isn't available during the propagation, and therefore the calculated field can't be added.
If this is the case, then you could work around this by adding a feature activated event handler to your feature and add the calculated field programmatically in that event.
Hope this helps.
Regards,
Magnus
My blog: InsomniacGeek.com -
To make fields display in List view
Hi,
In PCUI, I want to make fields appear in list view in detail area1, these fields appear in form view but when I toggle it to list view it disappears, I have made nescessary settings for field group attributes but I am unable to bring those field visible in list view.
Pls suggest
Thanks in Advance
VishalHi Tiest
I have appended custom fields in the screen structure, and functionally it is working fine whenever I create any transaction and it also retrives the data for custom fields when I open any transaction. These fields become visible in form view but not in list view, I have also unchecked n. List in the customizing settings for those fields.
Later I had generated the layout for that field group under my custom view.
In the personalize window only the standared fields are visible custom fields does not appear.
I am not able to understand properly what you are trying to say in this line:
Second possibility, besides have created a field group continaing the actual fields have you also created a field group typoe 'screen structure' responsible for the actual lay out.
Pls suggest where I am going wrong
Vishal -
How to calculate the total of a calculated column in a list view at the end of the view?
I have a view with the following columns ProductName, Quantity, Price, Total The total column is a calculated column which is the product of quantity and price. I want to place the sum of the total column by the end of the list view. I can do this with
the price and quantity but not with the total column. how do I do this?You can use SharePoint Designer and calculate the total in xslt view. Refer to the following post for more information
http://community.bamboosolutions.com/blogs/bambooteamblog/archive/2009/04/24/how-to-total-calculated-columns-in-a-sharepoint-list.aspx
http://blog.metrostarsystems.com/2012/12/03/jennys-sharepoint-tip-sum-calculated-columns/
Cheers, -
Multiple Filter on same field in sharepoint list
Hi All,
I had a SharePoint list with Product Code(single line), Product Name(single line), Phase(single line).
Product Code
Product Name
Phase
101
abc
P-I
102
def
P-II
103
ghi
P-III
104
jkl
P-I
105
mno
P-II
106
pqr
P-III
107
stu
P-I
108
vwx
P-II
109
yz
P-III
110
aab
P-I
Generally we can filter single value(P-I r P-II r P-III) on view with single value.
i need an filter on "Phase" column by Two valuse on "P-II" and "P-III"
Product Code
Product Name
Phase
102
def
P-II
103
ghi
P-III
105
mno
P-II
106
pqr
P-III
108
vwx
P-II
109
yz
P-III
Filtering with Multiple Values on same field.
Default, its supports up to ten values for filtering on one field, but i need more than 10 values..
How can i achieve this..
Advance Thanks..
NSHi NS,
The "Filter" function could only filter 10 columns by default in list view page ViewNew.aspx and ViewEdit.aspx, the value 10 is hard-coded in these two pages which are located at C:\Program Files\Common Files\microsoft shared\Web Server Extensions\14\TEMPLATE\LAYOUTS,
you can look at and increase all the value 10 realted to Filter function, this will make viewnew.aspx and viewedit.aspx show more than 10 filters.
Please firstly back up the orginial files viewNew.aspx and viewEdit.aspx page for a recovery if the file is corrupted by modifying, and do this test in a testing SharePoint environment before touching the production, this modification will affect to all
the SharePoint lists viewNew and ViewEdit page.
Also note that these modifications in the original file may be removed by the SharePoint CU or Service Pack.
Thanks
Daniel Yang
TechNet Community Support -
How to hide two fields in SharePoint list when a dropdown value selected?
Hi all,
I have a SharePoint list which have four columns 1 Title 2.Type (Dropdown: option1:Issues Option2:Risk) 3.Risk Name and 4.Risk type. If 'type' value is 'Issues' then I need to hide field 3 and 4. In other words, default value in dropdown should be 'Issue'
and want to hide field 3 and 4 are onload without using InfoPath.
How to achieve this? Thanks in advance!You can make use of jquery for the same. Add script editor webpart on the page and access the dropdown value and based on the value you get, show or hide the fields. Below are some pointers.
http://sachinvkatkar.blogspot.in/2013/02/hide-fields-from-sharepoint-newform.html
http://social.msdn.microsoft.com/Forums/sharepoint/en-US/50aa6f8d-f742-4400-82f3-7949ab1c215e/need-help-manipulating-form-fieldsrows-using-jquery?forum=sharepointdevelopmentprevious#802d9d4d-c19b-4752-a4fb-e38f40f50c51
http://social.technet.microsoft.com/wiki/contents/articles/21730.sharepoint-2010-conditionally-hide-fields-on-standard-list-forms-using-jquery.aspx
http://sharepointnadeem.blogspot.in/2013/09/sharepoint-showhide-list-column-based.html
Geetanjali Arora | My blogs | -
Is there a way to calculate a date field based on aother date field in sharepoint list?
In a SharePoint list, I have a 'Start of Use Date' and need to ensure the 'Review Date' is no more than 14 months after the 'Start of Use Date', but can't figure out the formula. Can you help?
You can cast the field values in the SPListItem to DateTime objects and call the AddMonths(int) function to see if the two are more than 14 months apart. For instance:
DateTime startOfUseDate = (DateTime) item["Start of Use Date"];
DateTime reviewDate = (DateTime) item["Review Date"];
if (startOfUseDate.AddMonths(14) >= reviewDate)
// Review Date IS NOT more than 14 months after Start of Use Date
else
// Review Date IS more than 14 months after Start of Use Date
Danny Jessee
MCPD - SharePoint Developer 2010
MCTS - SharePoint 2010, Configuring
dannyjessee.com/blog -
Create a Lookup for ProjetServer field in SharePoint List item
Hi,
I would like to display values in custom fields of MS Project Server 2010 in Ms SharePoint list 2010. The values ought to be displayed as lookup in a field of Listitem form. I would like to futher query and populate certain fields in New
Items form from Project Server based on the value in the lookup.
I am looking for guidance to implement this. Any help in this regard will be appreciated.Abhijit,
You could do this by creating an External Column, connected to an External COntent Type from Project Server.
Andrew Lavinsky has several good blog posts on using ECTs in Project Server. Here is an example: http://azlav.wordpress.com/2011/04/05/creating-a-centralized-document-repository-with-external-content-types/
Cheers,
Prasanna Adavi, Project MVP
Blog:
Podcast:
Twitter:
LinkedIn:
-
How to set one fixed folder to save rich content of rich text field in sharepoint list
hi friends
i have rich test filed in SharePoint list
if user wants add picture to rich text filed from insert option it is asking to save file in existing document libraries it is showing all libraries.
what i need is how can we fix one particular document library to save all this file from rich text filed.To my best knowledge, the only basic way to input picture in SharePoint Rich Text Editor (RTE) can be finished in two steps. One, upload it to you computer and then insert it URL to RTE. This works fine if I insert few of them.
Use SharePoint Rich Text Boost, which can let user insert images and Flash directly.
http://www.boostsolutions.com/richtextboost.html
If this helped you resolve your issue, please mark it Answered -
"You must specify a value for this required field" in SharePoint list
HI All,
I have a couple of taxonomy fields in my content type. When I try to add a new item with my content type and save, I'm getting an error message "You must specify a value for this required field" against each taxonomy field. I'm not sure what am
I missing. I deleted the content type and added that again to my list but still no luck. Can someone please help me out? Thanks.
Regards,
SC Vinodhi
it depends how you updated existing field. We faced with the problem that update of taxonomy site column was not propagated to the lists. In Sharepoint when content type is bound to the list, new hidden content type is created for that list - you may check
it if will enumerate
SPList.ContentTypes property. And when you try to update site column changes may not be propagated to these list content types. In order to update it you need to get reference on a field from list content type and update if explicitly.
Blog - http://sadomovalex.blogspot.com
Dynamic CAML queries via C# - http://camlex.codeplex.com -
Calculated Field formula not appearing in Power View Field List panel
Hi,
On Power View1 sheet of this
workbook, the two PowerPivot calculated Field formulas (First Visit and First date of FY) are not appearing in the Power View Fields panel on the right hand side.
I want to drag client and First Visit (calculated Field) to the Power View.
Why is this happening?
Regards, Ashish Mathur Microsoft Excel MVP www.ashishmathur.comI found a workaround for it - I was having the same problem as you. I wanted to display the last refresh date of my data, but Power View wouldn't display a date resulting from the [Last Refresh]=MAX(Date[Date]) formula.
HOWEVER, a Pivot Table can handle that Calculated field just fine. So I renamed my measure "Refreshed Date" and added another tab in the Excel Sheet. I added a Pivot Table from PowerPivot into cell A1 and the only thing I put was that single
measure (A2). To the right of that, I did =A2 and created an Excel Data Table. The title of that was "Last Refresh". Now, I could add that Data Table to the PowerPivot Model and into Power View. And then I hid that tab.
The only downside to this method, is that if you're refreshing single tables at a time, you have to remember to refresh the Pivot Table when new data is added AND update the data in the model. I'm only connecting to one database, so I just choose
"Refresh All" in Excel and it updates everything. It works perfectly! :)
Well shoot, I even took a screenshot that helped explain everything, but it won't let me post it because my account isn't verified and it won't tell me how. If you have any questions, please let me know and I'll clarify! -
Workflow not working if the trigger field isn't in the list view!
I have a list that displays important dates, and I have set up a reminder date column which calculated the reminder date by adding 7 days on to the set date. I then have a workflow that emails out reminder of this task if the reminder date matches today.
I have noticed that if I include the reminder date column in my list view, the workflow works fine. But as soon as I remove the reminder date field from the list view my workflow no longer works. It's obviously quite confusing to other having this reminder
date column there when it is only needed to trigger a workflow, so how do I trigger the workflow without having it on view?
Thanks!Hi Sarah,
As I understand, you have a Date column for user to set date, then you want a reminder date to add 7days to Date column. Then you would like to trigger a workflow if reminder date matches today.
If you do not want reminder date in the list, you could use the workflow 2013 action Core Actions > Add time to Date, to set a workflow variable to replace reminder date, and compare with today. Then you could omit reminder date column.
If you do want reminder date in the list, please try hide reminder date column in the list and test the issue again.
http://community.bamboosolutions.com/blogs/bambooteamblog/archive/2013/06/03/how-to-hide-a-sharepoint-list-column-from-a-list-form.aspx
Regards,
Rebecca Tu
TechNet Community Support
Maybe you are looking for
-
Note: I am in the process of moving the site to our central server so all pages, with the exception of the secure ones and the homepage, are redirected. See https://www.homelink-usa.com/secure/subscribe/subscribe.lasso which is secure and, in my brow
-
Pcmcia card locks my laptop up hard
...it's an atheros card, and I use madwifi to connect. Or I used to. Lappy locks up so tightly I have to power off. Any ideas?
-
Calculate percent difference of revenue dollars between company a and company b in SSAS cube
New to the world of SSAS cubes. Here is my scenario... I have company A that has revenue R for a given month. I have company B that has revenue S for the same month. I have Company C that has revenue T for the same month. I need to calculate the
-
help?
-
How to create new subtype to 0713 Termination?
Dear all, I want to add a new sub type to 0713 Termination. I know that using PM01 to create subtype for Infortype but I don't know how to do this . And when I Open Table T5F99T0 , I don't saw any Subtype on this . Please help me to do this step by