Ext.Net - Conversion element type ComboBox - ext.net

I have ComboBox with а few items. Default returned type of item's value - String. I would like to know how can I get 'Int' type of value of selected item in ComboBox.
Explicit conversion produces an error: Specified cast is not valid.
Thanks!:)

You can use int.Parse(box.SelectedValue). If it gives you an error, it means that the value is not an integer. In that case, it may be that the value is empty, and only the text is set.

Related

Using Index and match returning error: 'A value is not available to the formula or function'

I am trying to use Index and match combination to retrieve values in a column where the date from my table matches the date from another table. This is the formula:
=INDEX(BTL!A2:G262, MATCH(A2, BTL!A2:G262,0), MATCH("Overbooked?", BTL!B1:G262))
This is the table where I am using the formula:
This is the BTL table:
The error that is being returned is 'A value is not available to the formula or function'.
What's the reason for this?
The MATCH function returns the position of the lookup value in a 1-dimensional array. Imagine a row or a column. =MATCH(A2, BTL!A2:G262,0) will return an error because A2:G262 is a 2-D array. =MATCH(A2, BTL!A2:A262,0) has correct syntax but may still return an error if A2 isn't found. The absence of absolute referencing (like =MATCH(A2, BTL!$A$2:$A$262,0) makes the formula unfit for copying.
The same applied to MATCH("Overbooked?", BTL!B1:G262), except that B1:G262 isn't anywhere near the range you want to search. I think you mean the column and, therefore, must search in B1:G1.
Of course, if either of your MATCH functions returns an error the entire formula can't return a proper result either. Test the MATCH functions separately before inserting them into your INDEX function. You can also select them in the finished formula and press F9. Finally, you may like to guard against that by enclosing the formula in an IFERROR() function.
=IFERROR(INDEX(BTL!A2:G262, =MATCH(A2, BTL!A2:A262,0), MATCH("Overbooked?", BTL!B1:G1, 0)),"ERR")
I managed to resolve this by selecting the date column in the table where I was using the formula and using the 'text to columns' feature under the data tab. I selected the 'column data format' as 'date' and DMY

MATCH subtracting afterwards? MATCH (lookup;array;match_type) -1

The question: if MATCH uses (lookup;array;match type) why there is a -1 after?
I have an Excel sheet at work that uses match in a way I cannot figure out.
The original formula:
=IF(E2<>"";OFFSET('Sheet1'!$A$2;MATCH(E2;Streams;0)-1;0;COUNTIF(Streams;E2);1);ITID)
The break down for the MATCH's part is:
MATCH(E2;Streams;0)-1;
The lookup value "E2" contains selectable values from "Streams", which is a named list. This named list "Streams" contains non numeric values like:
LOG
PLTP
PTP
OTC
etc...
Just understood that Match gives back the number position of the result, not the result itself.

Right(text;5) is not the same as a 5 character text

I have a match function that I could not get working. I boiled it down to the point that it can't find the appropriate match since the values are not the same, apparently.
I have the value 21337 in cell D59. In cell S59 I have the function: Right($d59;5), which displays 21337. However when I enter in a cell: =D59=S59 i get the return FALSE.
I use the Right() function because cells in column D contain concatenated values, where the last 5 values are of importance. For example D60 contains 21337 - 21448, where 21448 is the value I want to match.
Anyone has a clue on what might be the problem?
With no formatting you'll see that 21337 is right aligned - showing this is a number and treated as a number by Excel.
On the other hand Right($d59;5) will show the number left aligned, indicating that the returned value is being treated as text by Excel.
If you try Right($d59;5)*1 Excel will implicitly convert the value back to a number (due to the calculation performed) and both values will be equal.
To be explicit about the conversion, as Brian has pointed out, use VALUE(Right($d59;5)).
If you use "Formula" > "Evaluate Formula", does it show the penultimate Evaluation as21337="21337"
The LEFT(..) function will convert the number to a string, and the string and the number will not equate. Try either =TEXT(D59,"#")=S59 or =D59=N(Left(S59)) to convert in your comparison, or change the code in S59 to =N(Right($D59,5)) to make S59 show a number
(The N(..) function converts a string to a number, returns 0 if Not A Number)

Excel PowerQuery: null values in a number column

I am using a PowerQuery query to import data from CSV files. Some cells in the CSV files are empty. When imported into PowerQuery, these cells get an error "Cannot convert the value null to type Number." The field gets (correctly) identified as type=number. However, I'd really just like these error values to just be blank entries, like they were in the original file. "Replace Errors" only allows me to change these error values into numbers (it won't let assign a blank or any non-numeric value). Any ideas on how to get these values to just be blank (or Null)?
The column has been typed as a whole number Int64 in the "Changed Type" step. Change the type of the column to Decimal number. You should no longer see Errors and your blanks will appear as "null" and will function as nulls.

How to get DataGridView column of signed numeric values to sort correctly?

How may I get a DataGridView column of signed numeric values to sort by signed value? Currently ColumnType is DataGridViewTextBoxColumn and ValueType is typeof(System.Single), but sorting is on the absolute rather than signed value, e.g:
-2.728
3.835
4.132
-4.511
Ignore what ValueType and column type are.
What is the type of the actual objects in the cells (dataGrid[x, y].Value.GetType())? You are probably filling the grid with System.String objects. If you fill the grid with System.Single objects they will be sorted properly.
Another option is to handle the SortCompare event.

Resources