"Calculated columns cannot contain volatile functions like Today and Me" error message on Sharepoint - datetime

I try to add a new calculated column to sharepoint list that will show elapsed day. I enter name and write a formula like;
=ABS(ROUND(Today-Created;0))
The data type returned from this formula is: Single line of text
When I want to save I get an error like
Calculated columns cannot contain volatile functions like Today and
Me.

Calculated Column Values Only Recalculate As Needed
The values in SharePoint columns--even in calculated columns--are stored in SharePoint's underlying SQL Server database.
The calculations in calculated columns are not performed upon page load; rather, they are recalculated only whenever an item is changed (in which case the formula is recalculated just for that specific item), or whenever the column formula is changed (in which case the formula is recalculated for all items).
(As a side note, this is the reason why in SharePoint 2010 you cannot create or change a calculated column on a list that has more than the list view threshold of 5000 items; it would require a mass update of values in all those items, which could impact database performance.)
Thus, in order for calculated columns to accurately store "volatile" values like "Me" and "Today", SharePoint would need to somehow constantly recalculate those column values and continuously update the column values in the database. This simply isn't possible.
Alternatives to Calculated Columns
I suggest taking a different approach entirely instead of using a calculated column for this purpose.
Conditional Formatting: You can apply conditional formatting to highlight records that meet certain criteria. This can be done using SharePoint Designer or HTML/JavaScript.
Filtered List views: Since views of lists are queried and generated in real time, you can use volatile values in list view filters. You can set up a list view web part that only shows items where Created is equal to [Today]. Since you can place multiple list view web parts on one page, you could have one section for today's items, and another web part for all the other items, giving you a visual separation.
A workflow, timer job, or scheduled task: You can use a repeating process to set the value of a normal (non-calculated) column on a daily basis. You need to be careful with this approach to ensure good performance; you wouldn't want it to query for and update every item in the list if the list has surpassed the list view threshold, for example.

I found some conversations about this issue. Many people suggest to creating a new Date Time column, visible is false, default value is Today's Date and it will be named as Today. Then we can use this column in our formulas.
I tried this suggestion and yes error is gone and formula is accepted but calculated columns' values are wrong. I setted column Today is visible and checked, it was empty. Default value Today's Date was not working. When I looking for a solution for this issue I deleted column Today carelessly. Then I realized calculated columns' values are right.
Finally; I don't know what is trick but before using Today keyword in your formulas if you create a column named as Today and after your formula saving if you delete Today column, it is working.
UPDATE
After #Thriggle's answer I realized this approach doesn't work like a charm. Yes, formula doesn't cause an error when calculated column saving but it works correctly only first time, in the next day the calculated column shows old values, because its values are static as Thriggle explained.

Related

check duplicate values in oracle forms multi record block

What I wanted is to display an alert when I move to the next row if the record that I inserted is already one of the records in the multi record block.
and in what trigger must I put it?
There are several options you can use.
One is to POST values entered (in WHEN-NEW-RECORD-INSTANCE) trigger. It will, well, post everything you entered so far. Then, you can write a WHEN-VALIDATE-ITEM trigger which SELECTs from that table and checks whether such a value already exists. Alternatively, if there's the UNIQUE CONSTRAINT on that (those) column(s), database will do its job itself, i.e. raise an exception.
Another option is to literally loop through all rows in a block and compare the first row's value with all the others, then the second row's values with all of them, etc.
Or, you can use a Record Group (usually used for Lists of Values). Basically, you'd check whether value you entered exists in a record group. More info, along with a FMB file, on Craig's blog.
Or, you can use calculated items, as described enter link description here (FMB attached as well).
As you can see, quite a few ways to do that; explore each of them and pick the one you find the most useful / attractive / easy to implement.

Is it possible to filter the list of fields when outputting a Full Dataset?

I have a DataTable that I'm passing to a FlexCel report. It contains a variable number of columns, so I'm using the Full Dataset feature (e.g. <#table_name.*>).
However, only a subset of the fields are dynamically generated (I have a variable number of attachments). The column name for each attachment field starts with a common word (e.g. "Attachment0", "Attachment1", etc).
What I would like to do is output the known finite set of fields and then the variable number of attachments. It would be nice if I could write something like <#table_name.Attachment*> (and <#table_name.Attachment**>). Is there any way in FlexCel Reports I can achieve the same result?
A side benefit to such a solution means that I could keep the formatting for the known/finite set of fields.
Update
I added place holder columns to the document, each with a <#delete column> tag, so that the un-wanted columns/data are removed.
Although this works, it's not ideal. For example, if I want to see how the columns fit in the page width (in print preview), then I need to hide the columns. Then I have to remember to un-hide them again, so other developers can see/understand my handy work.
It would be much more straight forward if I could filter the fields before they're output to the document.
I realised there's an alternate way around this problem. I broke up the data into two sets of data - <#table_name.*> and <#table_name_attachments.*>.
The fixed set of fields are in the first table and the variable set of fields is in the second table (all the "Attachment*" fields). When the report is run, I place them next to each other (in the same order) in the same worksheet. This means I have two table ranges - "_table_name_" and "_table_name_attachments_" on the one sheet.
Now I'm able to run my print preview without hiding/re-showing the columns-to-be-deleted. I've also eliminated human error - it was all to easy to accidentally set the wrong number of padded/delete columns.

Using 'Filter by Column Value' and multi column filtering using a java vector - xPages

I have an xPage which I have built with 3 combo boxes and 1 view control. I would like to use the 'Filter by column value' option within the view control to provide the options to filter the values, allowing the user to display any combination of the combo boxes. e.g. Only comboBox1, or comboBox1 and comboBox2, or comboBox3 only, or comboBox1 and comboBox2 and comboBox3.
I used the example in the 'xPages Demonstration Application' (http://www-10.lotus.com/ldd/ddwiki.nsf/dx/xpagesdemoapp.htm or http://xpagesblog.com/XPagesHome.nsf/Entry.xsp?documentId=AAC8E26599256FDC852578CB0066CC13) to do the multi-column filtering using a vector of non-categorized columns.
So, I have come across what appears to be a fairly major issue whereby the data needs to be sorted by date. Date is not one of the filters, but it needs to be the first column in order for the data to be sorted correctly. So my first column is a string, YYYYMMDD, to ensure the data is sorted correctly. I tried to use the sort option within the view control and that does not appear to work with the column filtering implemented in this manner.
So, as Date one of the criteria I am filtering by, I have passed that as an empty string - using the thought process that an empty string will select all (as in the url examples above).
The code I have used to do the filtering is:
var vtr:java.util.Vector = new java.util.Vector();
var t1 = sessionScope.Email;
var t2 = sessionScope.Own;
var t3 = sessionScope.Module;
vtr.addElement("");
#If(sessionScope.Own=="My calls",vtr.addElement(t1),vtr.addElement(""));
#If(sessionScope.Own=="My calls",vtr.addElement(""),vtr.addElement(t2));
#If(sessionScope.Status=="Open",vtr.addElement("Open"),vtr.addElement(""));
#If(sessionScope.Module=="All",vtr.addElement(""),vtr.addElement(t3));
return vtr;
What I have found is that not all data is being returned. I thought this might be due to the date field. So I removed it (changing the view and removing the first add element), and yet I still find that not all data is being returned. I suspect that this might be due to the empty strings being passed, or, that this does not actually work the way I had hoped.
Does anyone know if I can get this working the way I want it to, and if not, do you have any suggestion on how I can go about this?
Date is not needed as the first sortable column in the view. The first column does need to be sorted for the lookup to work just like the Notes view needs to be sorted for #DbColumn and #DbLookup to work. XPages uses the same underlining architecture. This example - http://dev.openntf.org/demos/demoapp.nsf/viewFilteringVector.xsp - works without the data being sorted by Date.
My guess as to why your example isn't working is down to how your Notes view sorted. Try creating a new view with column 1 (email) ascending sort, column 2 (own) ascending sort, and column 3 (module) again ascending sort. You should be able to get vector filtering working in this situation.
If all that doesn't work for you, you might consider multi-layer category filtering (new to 853). This filtering type in XPages is related to how categoryFilter works but allow you to filter a view by the sub-category (or sub-categories) too. This technique might suit your scenario better. Hope this helps.

InfoPath Repeating Tables: Force all rows to have same value for one column

Does anyone know a way to have all the rows of one column of a repeating table to always have the same value?
Say the user changes the value in the first row for that column, then all the other cells in that column change to have the new value. (Preferably this will happen if a user changes any cell in the column, not just the one in the first row, but just the first row would be fine if that's all that's possible).
I have access to both InfoPath 2007 and InfoPath 2010 so can use either. The form submits data to and receives data from an SQL Server database. Code is fine if this requires it.
You basically want to change the field from a repeating field to just multiple copies of the same field (since you want it to always be the same there is no point in storing multiple versions).
On the data source tab, all the fields that you put in the repeating section are in a group folder with the little repeating icon on it. Right click on the field you want to be non repeating and choose move. Put it anywhere outside the repeating group folder (the encompassing folder is usually a good choice but it can be anywhere). The field on the design surface will now show a little info box that says "this item can't be repeated" (or similar).
Now you just have multiple copies of the same field - so if you change any one of them they will all update to reflect the value.

salesforce.com matrix reports - more than 2 columns on row headings

I need to create a donor summary report that provides total donations by donor by year.
I need to provide
name address email yr1total yr2total etc...
It looks like salesforce only allows two columns in row headings and two columns in column headings. Is there a way to work around this
Or, is there a way to use the tabular report to do the same?
TIA
If donations is a single field on the donor's record, it seems like what you're looking to do is attempt to display two columns for the same data within a report. The best way to do this (well, outside of creating a master-detail relationship with a new custom object named "Donations") would to have formula fields for each of the donation years, and calculate the donation sums in each of them. That is, as long as you have a way of calculating the year of the donation.
I believe to get the best answer, more information is needed.
Something like this? This will work if your donation is a separate object that's linked to Account (I've used Tasks & Events linked to Accounts in my example).
Create a report in "Matrix format".
Drop Account Name on the left pane, Donation's Date on the columns.
Columns will default to days. Click the dropdown in the place where I have "Created Date" and select summarizing by year (of course fine-tune to whatever you need).
Check date ranges / filter criteria etc obviously if you don't see all data.
Click Show -> Hide details.
Drop your "Donation Amount" or similar field into place where "Record Count" is displayed. Use "Sum".
Optionally deselect Show -> Record Count.
Now you're mentioning that there are only 2 columns so you probably already tried this. Well, common trick is to cheat by using a formula field that would hold your data (separated by comma maybe?). Tabular report would require you to create some helper fields (1 per year) on Account and do some kind of rollup summaries, messy.
If it's for a dashboard you could play with summary report (it can have more groups than 2) and pick chart type table on the dashboard...

Resources