- This topic is empty.
- AuthorPosts
-
- 03/05/2015 at 4:15 am #7408
AnonymousParticipantHi
n
I suggest you can try to write some JavaScript to format the Calculated field in qListView.
n
1. Add a Script Editor web part into the page, insert a JavaScript about format the date function, it will be used as formating function in the calculated field in qListView. something like:
n
<script>
n
function FormatDate(date){
n
var oldDate = new Date(date);
n
var today = new Date();
n
return oldDate .getDate() – today.getDate();
n
}
n
</script>
n
2. Add a custom filed in qListView, invoke the JavaScript function in ‘Calculated Value’ setting, something like below, the <%Date%> is a parameter that you want to format:
n
<script>FormatDate('<%Date%>');</script>
n
But I would like the mention that if you do that, this calculated field cannot be sorted any more.
n
- 03/10/2015 at 3:22 am #6998
AnonymousParticipantHi
n
n
The [NOW] and [Today] are the internal key work for the web parts, but just for CAML, they do not support for calculated value. I think JavaScript is the only way to achieve it currently.
n
n
- 03/10/2015 at 4:07 am #6995
AnonymousParticipantThanks ,
n
So there is no way to reference Today without using JavaScript?
n
In the User Guide there is a reference to [Today] and <%Now%>, but only for CAML filtering. It would really simplify things if those types of values could be referenced in the Calculated Value field.
n
Is basic date math possible with the Calculated Value?
n
For example, if a numeric value was stored in a list column, called say Grace Period in Months. The user would simply store say the number 3. Every record associated with that would have 3 months of grace period added to their existing expiry date.
n
If the Grace Period in Months was changed to 4, the qListView would automatically display the expiry date plus 4 months. Would that require JavaScript to display?
n
There is no way to use the "Calculated Values" field for a custom column without JavaScript?
n
Hopefully this makes sense.
n
Thanks,
n
Trav
- 03/12/2015 at 3:25 am #7002
AnonymousParticipantHi
n
n
I have asked an enhancement request, the ID is #438597. I think this is a valuable feature for users.
n
n
- 03/12/2015 at 6:03 am #7000
AnonymousParticipantGood to know.
n
Would it be possible for Dell to consider replacement values like [Today] and [Now] to be accessible by for all areas of the system, not just the CAML filtering? It could go a long way.
n
Thanks,
n
Trav
- 03/17/2015 at 11:08 am #4635
AnonymousParticipantHi,
n
In a qListView we would like a display field we will use to count down the number of days until we hit a due date on a SP item.
n
I cannot find anyway to reference the current date whenever a qListView is open.
n
The assumption is we add a custom field to a qListView and in the Calculated Value field enter syntax like <%DueDate%> – @now or <$%DueDate%> – Today… at least as a starting point.
n
From there we will color code the rows for the typical 30, 60, 90 and 120+ days out.
n
Plus is there ANY documentation of real world examples of how to use the Calculated Values field.
n
Any advice would be great.
n
Thanks,
- 03/17/2015 at 11:08 am #7411
AnonymousParticipantThanks ,
n
While looking at those replacement values, being able to apply some Date math to those values would be a valuable as well.
n
Anyway,
n
Thanks for the help.
n
Trav
-
- AuthorPosts
You must be logged in to reply to this topic.