Formula language for a column view formula in Lotus Notes date calculation - lotus

I have a view that has a date field within the view. The user is asking that the first column of the view be categorized in the following manner and to have the titles as - < 30 Days, 30 - 90 Days and > 90 Days.
Here is part of the formula that I have created:
#TextToTime(i_LastComDate)<#Adjust(#TextToTime( "Today" );0;0;-30;0;0;0)
Can anyone help me out in getting the calculation for a categorized column in the Notes view to display the documents as determined by the category that the document should be displayed?
I have thought about adding a field to the form but the view would allow for a dynamic display so it would appear correctly when the user may view the documents.
Thank you,
Jean

#Today is a very bad idea to use in views as it causes the views to be permanently refreshed. There are a fiew best practices out there to handle your request. And there had been a discussion on stackoverflow here
A very good blog- entry is the one found here.
If you ignore all of the advices, then the formula would be:
_diff := (#Today - #TextToTime(i_LastComDate)) / (24*3600);
#If( _diff > 90 ; "< 90 Days"; _diff > 30; "< 30 Days" ; "All the others" )
ATTENTION: To store a time- value in a textfield is always very bad practice (just say this because of your usage of #TextToTime, as it might be stored like 2013/04/23 or 23.04.2013 or any other variation, just because the client or server that saved the field had this as preference...

I would suggest to make agent, that will recalculate time difference at nights - as #Tode said, time/date formulas in views have well known and documented performance impact and are discouraged to be used!
Your view will be then categorized by:
#If( diff < 30; "< 30"; diff <= 90; "30 - 90"; "> 90")

Related

Netsuite Formula Calcs

So I was able to create a search that shows historical unit rates at an item level then I can filter by customer to show any price increases that may have taken place to create a price tracker. It works as advertised. Below is a screen shot of what the output is. "Base Price" is the minimum item rate for lifespan since we transitioned to NetSuite. Then 1-6 months back it will pull the item rate and as you can see, around the 3rd month, it increases and shows change.
Here is how the search looks when executed
What I am attempting to do now subtract the values from the formula from the "base price" because that is at the end of the day the total impact value. Eventually I want to bring in quantity so we can see the total impact of these changes to track if we are seeing an increase or not.
EX. If base is $2 and we sell 20 a month. $40 in sales. Now we up it to $3, sales would be $60. But we want to show the $20 in increase impact instead.
Below is from the results tab to generate the above.
Here is the view from the Results Tab
Is there a way to create that calculation somehow in NS? I am almost thinking it is because I used the DECODE instead of the CASE WHEN ?
Thank you
You can generally combine supported functions; you just need to make sure that any functions applied in the Summary or Function columns are replicated in the formula. For example, your first column "Item Rate" has a Summary function or "Minimum" applied - this needs to be included in the formula, something like:
DECODE(...) - MIN({rate})

How should I display the record and hide the security constraint message in servicenow

Lets imagine first page of a table where 60 rows gets hidden by the ACL so the page shows 40 rows and a message at the end stating : "number of rows removed by security constraints: 60"
the other page shows 40 rows and the similar message...
So I want the page should display 100 rows which are accessible for the User so that the info message "number of rows removed by security constraints" is not visible at the bottom of the page.
I would say Query Business Rules are exactly what you want in this case (if you want to restrict entire records). They do not show the message at the bottom, don't make you go through 100 of pages to find the 10 records you need, and are generally faster than ACLs (a Query BR only gets evaluated once whereas an ACL has to be evaluated for every record).
If your "u_requested_for" field is a reference to user, the code you need is something like:
if(!gs.hasRole('admin') && gs.isInteractive()){
var q = current.addQuery('u_requested_for', gs.getUserID());
}
The only ways I know to do this, is to also write Query Business Rules. Generally the effort isn't worth it.

OBIEE 11g Sort Pivot Prompt

I have created a query that selects user base data from two different weeks, uses a MSUM to work out the difference between the two weeks and then create a projection of base size across different verticals based on the net change.
This requires the use of a pivot table with prompts to display just the data from the most recent financial week (in format YYYY-MM), however, every time a new week rolls around, it resets the ordering in the pivot prompt to show the least recent week, which makes the calculations redundant.
I can't re-order the weeks in the base data, as the MSUM calc requires a specific order to be used across multiple dimensions.
Whilst this is very easily fixed by the end user each time by changing the drop down, or by the support team by editing the pivot table and changing the prompt before saving, (which then persists until the next week), it is either going to be a poor customer experience, or extra work for the support group.
Is there a method that I'm missing to create a sort on the pivot prompt options from within the pivot table options?
The equation follows this kind of logic...
"Metrics"."Base Size" + (
(
(
"Metrics"."Base Size" - (
MSUM ("Metrics"."Base Size", 2) - "Metrics"."Base Size"
)
) / [days in time period]
) * 365
)
OBI will order the data as defined by the sort order in the RPD, but ascending is probably the best choice for it at that level.
In your case you could put the Analysis on a dashboard and use a dashboard prompt instead. For that you have the ability, in the options, to change the "Choice List Options" to SQL Results. This should put in a default query, to which you could add an ORDER BY clause. You can also set that to default to the most recent/current period no matter the sort order of the column.
SELECT "Date"."Financial Week"
FROM "My Subject Area"
ORDER BY "Date"."Financial Week" DESC
Instead of using the MSUM() function, you may also be better to use one of the built in time-series functions that can get the value of a previous period for you, without having to rely on any ordering. Have a look into the Ago() function to get the previous period.

How to customize partial sum in QlikView Pivot table

I'm a beginner for QlikView. I learnt that by going to presentation tab and click on show partial sum box and subtotal box, I can get the partial sum and subtotal. But my task is to calculate the average which means (subtotal/no of record)/ (partial sum/no of record). I've been suggested to use set analysis to calculate too. I have somehow calculated the numerator part but unable to get denominator.
This is my numerator :
Let vNumerator = 'SUM({<ACTIVITY={num1,num2}>} BOX_COUNT)/Count (record1 & record2)';
Any help is much appreciated.
From this scrap data
load * inline [
A,B,C,D,E
1,21,a,b,z,x
2,22,b,b,z,x
3,23,a,a,x,z
4,24,b,b,x,z
5,25,b,a,x,x
6,21,a,b,z,x
7,22,b,b,z,x
8,23,a,a,x,z
9,24,b,b,x,z
10,25,b,a,x,x
11,21,a,b,z,x
12,22,b,b,z,x
13,23,a,a,x,z
14,24,b,b,x,z
15,25,b,a,x,x
16,21,a,b,z,x
17,22,b,b,z,x
18,23,a,a,x,z
19,24,b,b,x,z
20,25,b,a,x,x
];
Which of these tables is what you are looking for out of the data?
All of these by defining a third expression as a combination of the others rather than trying to force it into an automatic subtotal.
Or make a table that shows the answers you want and post a picture of it. Even in excel is fine.
Also please let me know if I'm a million miles off the track here.
If you want to sum over ACTIVITY you need to use the following syntax:
sum( TOTAL<ACTIVITY> _your_expression_with_Set_ananaysis_ )
/
count( TOTAL<ACTIVITY> record1 & record2 )

Joomla K2 - How to order items by Extra Field Date

Me and a colleague are developing a website using joomla, we have ditched the joomla article component and replaced it with K2.
A part of the site's content , is posting (using K2 items) upcoming Live Events, such as an upcoming music concert, containing info about that event, images etc.
We want to find out if its possible to order these items, by the Date of the Event, or in other words how to order these items by the Extra Field : Date, of the item. K2 core only let's us order these items by Date Published or Date Created which is not what we need.
If anyone knows an easy way to overcome this obstacle it will be deeply appreciated!
we have been working on exactly the same events issue. K2 does not allow this, but we found a way of doing this in k2. The solution is an override of the template, but just one line is added.
Our events section is here vida latina events , there is 1 extra field "date". We wanted to order by this field (this solution would work for any other extra field too).
Solution
Create a menu item linking to an empty article.
Create a module k2 contents that selects from your k2 category, that appears on your new empty page
For "Order by", select "Title alphabetical" - we use this as we are going to hack it - so it needs to be an order you will not use for any other module
Open the file modules/mod_k2_content/helper.php
on line 195 find the code
case 'alpha' :
$orderby = 'i.title DESC';
break;
and replace with:
case 'alpha' :
$orderby = 'i.extra_fields DESC';
break;
This will work if you only have one extra field. If you have more than one extra field, you will have to modify the solution, but I think you get the general idea.
Hope this helps
Jeyjoo
I'm working on a similar project-making an event calendar using K2. I had the same question. What I am going to do is - for an event that is on Sept 22 2012, I will set the creation date at Sept 22 2011 (a year before). Then I will set K2 to order by "creation date" and set creation date to be hidden. This seems like a perfect solution...the only problem would be a leap year date (February 29) BUT you could set creation date to Feb 28 of the year before, and use the hours and minutes to get correct order that one day. I hope this makes sense.

Resources