Kendo number formatting - without exponent - kendo-ui

I have a column in grid with type of float and I would like to have numbers displayed without 'e'. Is that possilbe?
e.g.
I don't want -1e-7, but -0.0000001.
What format should I use for that column?

Found a solution. The problem is in Kendo DataSource, which automatically converts this kind of data. The solution is to have column template which would enforce formatting of value.
column.template = function(val) {
return kendo.toString(parseFloat(val[column.name]), '#.#######');
}

Related

Is there an ISNUMBER() or ISTEXT() equivalent for Power Query?

I have a column with mixed types of Number and Text and am trying to separate them into different columns using an if ... then ... else conditional. Is there an ISNUMBER() or ISTEXT equivalent for power query?
Here is how to check type in Excel Powerquery
IsNumber
=Value.Is(Value.FromText([ColumnOfMixedValues]), type number)
IsText
=Value.Is(Value.FromText([ColumnOfMixedValues]), type text)
hope it helps!
That depends a bit on the nature of the data and how it is originally encoded. Power Query is more strongly typed than Excel.
For example:
Source = Table.FromRecords({[A=1],[A="1"],[A="a"]})
Creates a table with three rows. The first row's data type is number. The second and third rows are both text. But the second row's text could be interpreted as a number.
The following is a query that creates two new columns showing if each row is a text or number type. The first column checks the data type. The second column attempts to guess the data type based on the value. The guessing code assumes everything that isn't a number is text.
Example Code
Edit: Borrowing from #AlejandroLopez-Lago-MSFT's comment for the interpreted type.
let
Source = Table.FromRecords({[A=1],[A="1"],[A="a"]}),
#"Added Custom" = Table.AddColumn(Source, "Type", each
let
TypeLookup = (inputType as type) as text =>
Table.FromRecords(
{
[Type=type text, Value="Text"],
[Type=type number, Value="Number"]
}
){[Type=inputType]}[Value]
in
TypeLookup(Value.Type([A]))
),
#"Added Custom 2" = Table.AddColumn(#"Added Custom", "Interpreted Type", each
let
result = try Number.From([A]) otherwise "Text",
resultType = if result = "Text" then "Text" else "Number"
in
resultType
)
in
#"Added Custom 2"
Sample output
Put it in logical test format
Value.Type([Column1]) = type number
Value.Type([Column1]) = type text
The function Value.Type returns a type, so by putting it in equation thus return a true / false.
Also, equivalently,
Value.Type([Column1]) = Date.Type
Value.Type([Column1]) = Text.Type
HTH
ISTEXT() doesn't exist in any language I've worked with - typically any numeric or date value can be converted to text so what would be a false result?
For ISNUMBER, I would solve this without any code by changing the Data Type to a number type e.g. Whole Number. Any rows that don't convert will show Error - you can then apply Replace Errors or Remove Errors to handle them.
Use Duplicate Column first if you don't want to disturb the original column.
I agree with Mike Honey.
I have a SKU code that is a mix of Char and Num.
Normally the last 8 Char are Numbers but in some weird circumstances the SKU is repeated with an additional letter but given the same EAN which causes chaos.
by creating a new temp column using Text.End(SKU, 1) I get only the last character. I then convert that column to Whole Number. Any Error rows are then removed to leave only the rows I need. I then delete the temp Column and am left with the Rows I need in the format I started with.

SSRS Matrix hide last column

I want to hide the last column for matrix in SSRS.
The column is in number format.
I have try the column visibility with expression like
IIF(Fields!abc.Value = Last(Fields!abc.Value), true, false)
but it didnt work. It still show all columns.
Is it my last function use incorrectly?
Any other way to do this ?

Kendo UI Grid sum aggregate on a column with an optional property

I'm using the Aggregates feature of a Kendo UI Grid Widget to display the sum of a grouped column. The column in question is bound to an optional field / property so when the data set includes a data item where property is not present (i.e. undefined), the sum ends up being NaN as you would expect.
The Kendo DataSource calculates these aggregates "when the data source populates with data" but does not include a feature to allow custom aggregates that would allow me to implement a version of sum that substitutes 0 for undefined values.
I can see where the sum aggregate function is defined in kendo.data.js but I would prefer not to change that if possible.
I have an idea how to solve this by writing a function to query the $("#myGridId").data("kendoGrid").dataSource but I'd like to know if there is a better option.
After comparing the latest code in kendo.data.js to my project version (2013.1.319) I see that they have changed the implementation of the sum aggregate function to handle this case by only performing the addition if the value is a number. Problem solved if I can get the project updated to the latest version of Kendo UI.
The code snippet below is at line 1369 of version 2014.1.416.
sum: function(accumulator, item, accessor) {
var value = accessor.get(item);
if (!isNumber(accumulator)) {
accumulator = value;
} else if (isNumber(value)) {
accumulator += value;
}
return accumulator;
}

How do I split birt dataset column into multiple rows

My datasource has a column that contains a comma-separated list of numbers.
I want to create a dataset that takes those numbers and turns them into groupings to use in a bar chart.
requirements
numbers will be between 0-17 inclusive
groupings: 0-2,3-5,6-10,11-17
x-axis labels have to be the groupings
y-axis is the percent of rows that contain that grouping
note that because each row can contribute to multiple columns the percentages can add up to > 100%
any help you can offer would be awesome... i'm very new to BIRT and have been stuck on this for a couple days now
Not sure that I understand the requirements exactly, but your basic question "split dataset column into multiple rows" can be solved either using a scripted dataset or with pure SQL (depending on your DB).
Either way, you will need a second dataset (e.g. your data model is master-detail, and in your layout you will need something like
Table/List "Master bound to master DS
Table/List "Detail" bound to detail DS
The detail DS need the comma-separated result column from the master DS as an input parameter of type "String".
Doing this with a scripted dataset is quite easy IFF you understand Javascript AND you understand how scripted datasets work: Create a report variable "myValues" of type object with a default value of null and a second report variable "myValuesIndex" of type integer with a default value of 0.
(Note: this is all untested!)
Create the dataset "detail" as a scripted DS, with one input parameter "csv" of type String and one output parameter "value" of type String.
In the open event of the scripted DS, code:
vars["myValues"] = this.getInputParameterValue("csv").split(",");
vars["myValuesIndex"] = 0;
In the fetch event, code:
var i = vars["myValuesIndex"];
var len = vars["myValues"].length;
if (i < len) {
row["value"] = vars["myValues"][i];
vars["myValuesIndex"] = i+1;
return true;
} else {
return false;
}
For example, for the master DS result row with csv = "1,2,3-4,foo", the detail DS will result in 4 rows with
value = "1"
value = "2"
value = "3-4"
value = "foo"
Using an Oracle DB, this can be done without Javascript. The detail DS (with the same input parameter as above) would then look like:
select t.value as value from table(split(?)) t
For the definition of the split function, see RedFilter's answer on
Is there a function to split a string in PL/SQL?
If you get ORA-22813, you should change the original definition
create or replace type split_tbl as table of varchar2(32767);
to
create or replace type split_tbl as table of varchar2(4000);
as mentioned on https://community.oracle.com/thread/2288603?tstart=0
It's also possible with pure SQL in 11g using regexp_substr (see the same page).
create parameters in the scripted data set. we have to pass or link actual dataset values to scripted dataset parameters through DataSet parameter Binding after assigning the scripted data set to Table.

Change the Sequence of JqGrid Columns

I wanted to change the grid column sequence dynamically. For e.g. By default the grid will be loaded in LoginId, FirstName and LastName sequence. Based on some condition, I need to change the FirstName and LastName sequence.
Is there any way I can do this?
I tried doing like:
{name:'UserName',index:'UserName',width:82,sortable:false},
if(true)
{
{name:'FirstName',index:'FirstName',width:65,sortable:false},
{name:'LastName',index:'LastName',width:65,sortable:false},
}
else
{
{name:'LastName',index:'LastName',width:65,sortable:false},
{name:'FirstName',index:'FirstName',width:65,sortable:false},
}
but I could not get this work.
You can use remapColumns function to do this. In the documentation of the function you will find the example which seems to be wrong, because indexes in the permutation array seem to be 1-based and not 0-based. Try to use:
$("#list").remapColumns([1,3,2],true,false);
or
$("#list").remapColumns([1,3,2,4,5,6,7,8,9],true,false);
if you want to change the order of the second and third from the total 9 columns.

Resources