Changing portlet item color scheme based off of date - maximo

I am trying to change the colors of lines displayed in my portlet based off of a date range. The following are examples of what I am trying to do.
within the last 7 days - green
greater than 7 days - red.
I have tried the following expressions :date - 7 and it does not work, I am assuming as there is not an overloaded operator to handle the subtraction between a date object and a integer. Also for the expression field, can it handle function calls? As I have also tried to use getdate() which does not work here.

Assuming you are talking about a ResultSet portlet on a Start Center, date math has historically been abysmal in this context. You would be better to write an Automation Script to support a new Function and then call your Function from an Attribute Formula. You can then do your color coded rows against the integer attribute you associated to the Formula.
The only thing I found lacking in the relevant Help and product documentation was that your script needs to return its calculation result in a variable called retval or whatever it is for Custom Condition launch points.

Related

Counting excel cells within a time window

I am trying to get a formula that will help count cells that fall within a time window. I came up with a formula but it only works when the time is from AM to PM and not for PM (previous day) to AM (next day). As shown in the image, I want to be able to count the number of Korea trades (from Table 2) within trading window (Table 3). I was trying to use the highlighted formula but apparently it's not working on Table 1.
Formula: =COUNTIFS(D13:D16, "Korea", E13:E16, ">="&H4, E13:E16, "<="&I4)
Is there a way to achieve this?
When the times cross midnight for Korea, you'll need to do an OR condition rather than an and condition. You could do this by making two countifs functions or use Sumproduct as shown below:
=SUMPRODUCT((D13:D16="Korea")*((E13:E16>=H3)+(E13:E16<=I3)))
If you have access to a version of Excel that supports the Lambda function I’d suggest creating a lambda that does the within checking so it’s not done through the formulas on your sheet. Unfortunately I don’t think there are Ifs functions that take a lamdba as a criteria but you might be able to use Map to generate an array of booleans and get the product similar to the other reply.
So I started by creating a lambda for determining if the value is in the range. The formula I used is:
=LAMBDA(s,e,IF(s<e,LAMBDA(x,AND(x>=s,x<e)),LAMBDA(x,OR(x<e,x>s))))
That basically takes 2 parameters - your starting time and the ending time for the range. It will return a lambda that will take the time to compare. And I added that as a namedreference named “IsWithin”
Then I created another lambda that would do the overall count.
=LAMBDA(rangeMatch,textMatch,rangeTime,start,end,SUM(MAP(rangeMatch,LAMBDA(x,ISNUMBER(SEARCH(textMatch,x))))*MAP(rangeTime,IsWithin(start,end))))
The function takes 5 parameters:
the range for which you are searching for the country name
the text to match within the range
the range containing the times to evaluate
the start time for the valid range (e.g. H3)
the end time for the valid range (e.g. I3)
It uses the Map function to evaluate the items in the range using lambdas. The first part of the evaluate creates an array of the items that have the matching text so either TRUE or FALSE. The second part creates an array of items that are within the specified time range - again either TRUE or FALSE. And then it just multiplies those arrays and sums the values essentially getting those where both values are true. Then to use it you just call that named reference:
=CountMatch(D13:D16,"Korea",E13:E16,H4,I4)
You can try this
=SUMPRODUCT(--(LEN(D13:D16)<>LEN(SUBSTITUTE(D13:D16,"Korea","")))*((E13:E16>=H4)+(E13:E16<=I4)))

Multiple conditions finding median in Excel

I have included a link to a sample sheet. It contains home sales for 17 years and includes the property type (Type), price (SP), Value (Price/SQF), and Size (SQF). I want to find the median of each for every type, for every year, and for every month.
https://drive.google.com/file/d/1ecmNoQ5g3xr2GsaxeHwupq3Rqnu84puD/view?usp=sharing
I used this formula (for example) for finding the median value each year, but when I manually check it, it is incorrect: {=AGGREGATE(17,6,Value/((YEAR(Closing_Date)=$J127)*(Type="Condo")),2)}.
I really don't understand how that formula works (specifically, the "17,6" and the "2" at the end). I've tried using the =median with all the conditions but I get missing argument errors. Not sure what to do.
I've included space and allow editing of the test file if that helps. Once I see the formulas for one property type, I'll be able to replicate for the other 2 types.
picture of data file
{=AGGREGATE(17,6,Value/((YEAR(Closing_Date)=$J127)*(Type="Condo")),2)} is the right answer. After studying quartile.inc I realized I had a different error that was the causing the problem.

NetSuite saved search filter records with min quantity

How do I apply following requirement in Saved Search criteria?
Filter all inventory items
Where min( {memberitem.quantityavailable} / {memberquantity} ) <> custitem_quantity
Note: custitem_quantity is a custom numeric field.
Note2: NetSuite is throwing error when I use min function in filters.
There is more than one issue here.
You have to be careful with custom numerics in Netsuite.
When your inner condition evaluates, it does not have the same type because it is fractional. At some point it has to be rounded and / or truncated internally. The other side of the expression would need to call a floor or ceiling function to remove everthing past the decimal.
Also, the min function evaluates after the <> conditional, which will be dependent upon whether your custom numeric is type compatible to begin with.
In the expression you provided us, it would have to be an exact match (and an exact type), and that is before you consider whether MIN gets to be evaluated.
Look at how the datatypes are cast and what columns you are processing because memberitem.quantityavailable may need a secondary index depending upon your dependencies and where the formula is being called. If this formula is being used over multiple products, it may not be logically consistent.
When I have similar items in inventory that I want to generate stats for I try to process it separately, even if I have to make a second pass.
What are you trying to isolate exactly - - I cannot think of a quantity-related situation where there would be a need to use division in this way - - please refer to the formula Mike Robbins listed above for a properly structured evaluation and see if it achieves the desired result.
If you post the rest of your code, I will help you resolve this.
The entire expression is not valid and will not evaluate due to the conditional shown, the MIN, nor the division. Index the count on the memberquantity if you are looking to sum over values. Otherwise, CountIF will work for quantities. MIN will only finds the lowest value in a given column, so SumIF appears to be what you are after. You can create a second expression which bounds the values you are searching for as a preliminary step.
I am new here, so please elaborate on what you are trying to accomplish so I can earn the bounty.
You may want to take into account null values as well to avoid errors or inconsistent data.
If you're using formula numeric, try this:
Formula(Numeric):
case when min((NVL({memberitem.quantityavailable},0) / NVL({memberquantity},0)) - (NVL{custitem_quantity},0)) then 1 else 0 end
'IS EQUAL TO' 1
I believe you can use the Formula Text or Formula Numeric Search Filter for that.

SSRS 2012 Expression builder Today() error

I have two SSRS Parameters, Date/Time type: BeginDate and EndDate. I want them to default to EndDate=Today() and BeginDate=Today()-six months. Using Report Parameters, Default Values, I add a value and create the function =Today() but I get the red squiggly line under the parens.
If I select the function from the Category list and double click it into the "Set Expression for:Value" box, I get the function with a single open-paren and the red squiggly which remains if I close off with a close-paren.
I get the same error if (following the example in the "Example" section, for crist's sake) of =DateAdd("m", -6, Today()) I get the same error instead of a date six months prior.
A little help please...?
Thanks
The problem is that you are using SQL command syntax but Reporting Services uses VBA.
Even though the examples show Today() with the brackets after it, as if it was a method, that actually displays as a syntax error for me in the expression editor. Today's date is simply accessed like a property:
=Today
DateAdd exists but uses DateInterval properties, not the SQL "m" so six months ago is:
=DateAdd(DateInterval.Month, -6, Today)

Calculated formula for sharepoint list to return "expired"

The formula I am using is:
=IF((DATEDIF(Todaycalc,[TERMINATION DATE],"d"))<0,"Expired","")
but while it calculates for the NO, I am getting a #NUM error for the part I want to return as "expired". the calculated field is set to text.
I'm not sure what the TodayCalc item in your DATEDIF function is. If this is a column then it needs to be inside brackets [Todaycalc]. If you are trying to use the TODAY formula to return the current date, you cannot use this (or ME) in Calculated Columns.
There is a trick to getting this to "work" where you use a column named Today, use it in the formula then delete it. But it is a silly trick since it still only calculates when an item is created/modified. You might as well use the Modified column.
As #thisChrisKent has said you can't use the [Today] trick without some serious workarounds - it just doesn't work as you would expect it too.
You've a couple of options for doing this sort of dynamic view.
Convert the List View Web Part (LVWP) to a Data View Web Part (DVWP) and add formatting via SharePoint designer and/or XSLT/JavaScript
Add javascript in a Content Editor Web Part to apply the formatting - Christophe is a great source for this sort of stuff which you could adapt for your needs.
3rd party products and custom calcualted columns - such as Highlighter, Follow-Up, Corus Works and others
(disclaimer - first link is from my own company)

Resources