Kindo grid filter on decimal values defaulting to two decimal places - telerik-grid

I have a Telerik-Kindo Grid in which one of the columns is a number with four decimal places. When I am trying to filter in that column, it is accepting four decimal places in the filter text field but while actually filtering, the in-built filter function is considering on the first two decimal places. I know this for sure because, when I click on the filter button associated with the column after filtering, the text field displays the number I entered with just two decimal places. My other two decimal values are taken off.
Is there any way that I can make the filter function of the Telerik-Kindo Grid to consider all of my 4 decimal values for filtering?

Below is the solution for this.
This is what you put in the MVC wrapper
.Filterable(filterable => filterable.UI("customNumericFilter"))
And implementation of that in your Java Script
function customNumericFilter (element) {
element.kendoNumericTextBox({
format: "n5",
decimals: 5
});
}

Related

EXCEL - Dual VLOOKUP and Interpolation

I have a table on Excel with data as the following:
Meaning, I have different JPH based on the %SMALL unit and the number of active stations.
I need to create a matrix like the following (with %SMALL on horizontal and STATIONS on vertical axes):
And the formula for each cell should:
Take the input of Stations (column "B")
Check, for that specific Stations number, the amount of data on the other table (like make a filter on STATIONS for the specific number)
Perform an VLOOKUP for checking the JPH based on the %SMALL value on row 2
Interpolate for the exact JPH value, if not found on table
For now, I was able to create the last part (the VLOOKUP and the interpolation), with the following:
=IFERROR(VLOOKUP(C2;'EARLY-STATIONS'!$F:$H;3;FALSE);AVERAGE(OFFSET(INDEX('EARLY-STATIONS'!$H:$H;MATCH(C2;'EARLY-STATIONS'!$F:$F;1));0;0;2;1)))
The problem I'm facing is than with this, the calculation is not checking the number of stations, so the Iteration is not accurate.
Unfortunately I cannot use VBA macros to solve this.
Any clue?
This is an attempt because more clarity is needed in terms of all possible scenarios to consider, based on different input data and how to understand the "extrapolation" process. This approach understands as extrapolation the average of two values (lower and greater), but the idea can be customized to any other way to calculate it. Per tags listed in the question I assume there is no Excel version constraint. This is O365 solution:
=LET(sm, A2:A10, st, B2:B10, jph, C2:C10, smx, F1:J1, sty, E2:E4, NULL, "",
GETLk, LAMBDA(x,y,mode, FILTER(jph, (st=y)
* (sm = INDEX(sm, XMATCH(x, sm, mode))), NULL)),
GET, LAMBDA(x,y, LET(f, FILTER(jph, (jph=GETLk(x,y, 1))
+ (jph=GETLk(x,y, -1)), NULL), IF(#f=NULL, NULL, AVERAGE(f)))),
HREDUCE, LAMBDA(yi, DROP(REDUCE("", smx, LAMBDA(ac,x,
HSTACK(ac, GET(x, yi)))),,1)),
DROP(REDUCE("", sty, LAMBDA(ac,y, VSTACK(ac, HREDUCE(y)))),1))
The above formula spills the entire result, I don't think for this case you can use a LOOKUP-like function.
Here is the output:
The highlighted cells where the average is calculated.
Explanation
The main idea is to use DROP/REDUCE/HSTACK/VSTACK pattern to generate the grid. Check my answer to the following question: how to transform a table in Excel from vertical to horizontal but with different length on how to apply it.
We use two user LAMBDA functions to abstract some calculations:
GETLk(x,y,mode), filters jph name based on %SMALL and Stations columns values, based on input values x (x-axis value from the grid), y (y-axis value form the grid) respectively. The third input argument mode, is for doing the approximate search in XMATCH (1-next largest, -1 next smallest). In case the value exist in the input table, XMATCH returns the same value in both cases.
GET(x,y) has the logic to find the value or if the value doesn't exist to calculate the average. It uses the previous LAMBDA function GETLk. We filter for jph values that match the input values (x,y), but we use an OR condition in the FILTER (+), to select both lower or greater values. If the value exist, returns just one value otherwise two values are returned by FILTER (f). Finally if f is not empty we return the average, otherwise the value we setup as NULL.
HREDUCE: Concatenate the result by columns for a given row of the grid. Check the referred question for more information about it.

How to extract text from a string between where there are multiple entires that meet the criteria and return all values

This is an exmaple of the string, and it can be longer
1160752 Meranji Oil Sats -Mt(MA) (000600007056 0001), PE:Toolachee Gas Sats -Mt(MA) (000600007070 0003)GL: Contract Services (510000), COT: Network (N), CO: OM-A00009.0723,Oil Sats -Mt(MA) (000600007053 0003)
The result needs to be column1 600007056 column2 600007070 column3 600007053
I am working in Spotfire and creating calclated columns through transformations as I need the columns to join to other data sets
I have tried the below, but it is only picking up the 1st 600.. number not the others, and there can be an undefined amount of those.
Account is the column with the string
Mid([Account],
Find("(000",[Account]) + Len("(000"),
Find("0001)",[Account]) - Find("(000",[Account]) - Len("(000"))
Thank you!
Assuming my guess is correct, and the pattern to look for is:
9 numbers, starting with 6, preceded by 1 opening parenthesis and 3 zeros, followed by a space, 4 numbers and a closing parenthesis
you can grab individual occurrences by:
column1: RXExtract([Amount],'(?<=\\(000)6\\d{8}(?=\\s\\d{4}\\))',1)
column2: RXExtract([Amount],'(?<=\\(000)6\\d{8}(?=\\s\\d{4}\\))',2)
etc.
The tricky bit is to find how many columns to define, as you say there can be many. One way to know would be to first calculate a max number of occurrences like this:
maxn: Max((Len([Amount]) - Len(RXReplace([Amount],'(?<=\\(000)6\\d{8}(?=\\s\\d{4}\\))','','g'))) / 9)
still assuming the number of digits in each column to extract is 9. This compares the length of the original [Amount] to the one with the extracted patterns replaced by an empty string, divided by 9.
Then you know you can define up to maxn columns, the extra ones for the rows with fewer instances will be empty.
Note that Spotfire always wants two back-slash for escaping (I had to add more to the editor to make it render correctly, I hope I have not missed any).

excel function for divide or split number to maximum possible equal parts

I need to split(like divide) by 5, however each value should balance maximum possible way to each part
Example
6= 3,3 is ok. but 6= 5,1 is wrong
18= 5,5,4,4 is ok. but 18= 5,5,5,3 is wrong
21= 5,4,4,4,4 is ok. but 21= 5,5,5,5,1 is wrong
The underlying math for this is as follows. Number have to split will be split into repeats of two numbers. The smaller number is given by
=QUOTIENT(NUMBER_HAVE_TO_SPLIT,SPLIT_BY_PARTS)
and the larger number is given by
=QUOTIENT(NUMBER_HAVE_TO_SPLIT,SPLIT_BY_PARTS)+1
FYI the QUOTIENT worksheet function does integer division, e.g, QUOTIENT(13,4)=3.
The number of times the larger number is repeated is given by:
=MOD(NUMBER_HAVE_TO_SPLIT,SPLIT_BY_PARTS)
and the number of times the smaller number is repeated is given by:
=SPLIT_BY_PARTS - MOD(NUMBER_HAVE_TO_SPLIT,SPLIT_BY_PARTS)
The remaining task is to return the results in the formats you suggest. To get the comma-delimited format 3,4,4:
Convert both smaller number and larger number to text using TEXT(number,0)
Prepend each with a comma to give the strings ,3 and ,4
Use the REPT function to repeat each the appropriate number of times to give ,3 and ,4,4
Concatenate these two strings and use SUBSTITUTE to remove the first comma
A somewhat messy formula to accomplish the above is:
=SUBSTITUTE(REPT(","&TEXT(QUOTIENT(A2,B2),"0"),B2-MOD(A2,B2))&REPT(","&TEXT(QUOTIENT(A2,B2)+1,"0"),MOD(A2,B2)),",","",1)
where NUMBER_HAVE_TO_SPLIT and SPLIT_BY_PARTS are in A2 and B2, respectively.
A formula to generate the 3=1 and 4=2 format is
=TEXT(QUOTIENT(A2,B2),0)&"="&TEXT(B2-MOD(A2,B2),"0")&IF(MOD(A2,B2)>0," and "&TEXT(QUOTIENT(A2,B2)+1,0)&"="&TEXT(MOD(A2,B2),"0"),"")

Excel Text Format Number to round to millions

Is there a way to imbed a number in a text string, while still rounding it to millions and showing an 'm'?
If it was just formatting, I would use:
#.#,, 'm'
and in text I would use:
text(ref, "#.#,,")
but how can you combine the two? the below does not work
text(ref, "#.#,,m")
=TEXT(ROUND(ref,-6)/1000000,"#,##0")&"m"
This would round a number up to millions and then replace the 6 0's with the letter 'm'. e.g. 4,658,458,685 would become:
4,658m
Edit:
The following works as requested with everything inside the TEXT function:
=TEXT(ref, "#.#,," & """m""")

Problem sorting a view based on a text field with numeric values in Lotus Notes

An existing Lotus Notes database form has a text field whic contains a numeric value. I am trying create a view to sort on this field but the result is coming up as follows
99
1000
1002
1003
101
1011
Is there any way to convert the field so I can sort numerically. Lotus Notes 6.5.
In the column formula, convert your item to a number using
#TextToNumber( itemname )
Because the text field has numeric values, they are still treated as literal string. So, the easiest way I have found to format them and avoiding #Errors' is to pad them with leading zeroes as well and continue to treat them as a string.
The good thing about this solution is that we're still dealing with strings. No mucking about with data type conversions where you may have data that cannot be converted into a number.
So put this into your column formula and set the sorting options as ascending or descending as you require:
MaxSize := 10;
len := #Length(#trim(yourField));
Pad := MaxSize - Len;
#Repeat("0";pad) + #trim(yourField);
Make sure that your "MaxSize" value is greater than the length of any value it receives. From the sample you've provided, 4 looks like it will do the trick.
(As per Ken's suggestion), if the appearance of the padded column to the user is not appealing, you can make this column a hidden, sorted column and then present the original unformatted (and unsorted) column to the user so it appears in a numerical order.

Resources