We are using Umbraco 7.5.x on Umbraco Cloud. we have a custom document type with a Umbraco.Decimal datatype.
The correct values are being stored as we can edit them from the backoffice. But when we try to display those values, only values above zero are show properly. Negative values (eg -0.75) are not displayed.
What is the correct way to display the values of this datatype so all values are shown?
Our use case above is, we have a nodes that display values of stock prices, which can be negative sometimes. the values are stored in a Umbraco.decimal field. The positive values display without any issues. Any negative values display as zero.
For example in our view, we grab the a particular node, and display its value from the fields:
#{
var lastStockValues = Umbraco.Content(123).Children.Last();
}
<div>#((lastStockValues.stockdelta*100).ToString("0.##")) % </div>
Thanks!
I strongly recommend using typed models rather than dynamic ones. This way you can be sure your types are correct:
#{
var lastStockValuesNode = Umbraco.TypedContent(123).Children().Last();
}
<div>#((lastStockValuesNode.GetPropertyValue<decimal>("stockdelta") * 100).ToString("0.##"))</div>
In this case, lastStockValuesNode is of type IPublishedContent which represents a page/node in Umbraco.
You can then use the method .GetPropertyValue<type>(alias). In this case, we are casting to type decimal.
This may solve your issue if the dynamic typing is converting the decimal to the wrong type.
Documentation: https://our.umbraco.org/documentation/reference/querying/UmbracoHelper/#typedcontent-int-id
Related
I have a dimension that has this structure :, example: JIRA-525:Ticket Summary.
I'd like to extract the second part, but with no positive result.
I tried to create a custom field on that dimension and do a string operation, I know this won't give me expected result, but a basic string function is not working, as the grid is showing errors:
left([Concept].CurrentMember.Name,10)
What should I do differentñy?
The error message could give us some hints on what is wrong here. If you created a new calculated measure with the formula, it should return results.
Define a new calculated measure (measure not member, sometimes people mix them up) with the formula below:
[Concept].CurrentMember.AllProperties
Does that return any results with the dimension on rows? Does it have a "Name" property?
Ultimately, I would suggest creating a new calculated measure with ExtractString() function - https://docs.eazybi.com/eazybi/analyze-and-visualize/calculated-measures-and-members/mdx-function-reference/extractstring. But first see what properties are available.
If you are looking to change the dimension member names, then that can be done only with JavaScript calculated custom fields - https://docs.eazybi.com/eazybijira/data-import/custom-fields/javascript-calculated-custom-fields.
I am creating RDLC Reports (this one is a subreport actually), that hides a specific Text-Box depending on data available/missing.
Specifically, I want to hide a Text Box, using an "Expression", when all values of a specific DataSet are null. Currently I do only check the first value like so:
=(IsNothing(First(Fields!EventDescription.Value, "MyDataSet")))
This works, regarding only the first item in the DataSet, or when it's empty. How can I check for "All". Is there an "All" operator?
I now have
=((Sum(IIF(IsNothing(Fields!EventDescription.Value),0,1), "MyDataSet") ) = 0)
which looks a little complicated, but works. It
checks whether the given Field is NULL
if not so, provides the integer value 1
sums all those values up
hides the text box, when the sum is zero (all fields have been null)
Essentially this converts an aggregate comparison into a sum.
I’m using the vaadin-grid#^3.0.2 in my polymer 1.0 project.
But I’m looking to create an on/off toggle button that will filter a column based on if the text in two columns are not a match. So if a row in column 1 contains text=“1.1.1” and that same row in column 2 contains text = “2.1.1" then I would keep this row displayed, and hide all other rows. I want to do this in javscript. I’m very new to the vaadin-grid (had so much previous experience with iron-data-table). Anyone have a suggestion on how I can access the filter function?
image of 2 different columns of versions
I tried using the standard filter element but it's too limiting because it only allows me to do string based filtering on just one-specific column, but it's not built so I can do a comparison between strings in two different columns.
<vaadin-grid-filter path="version" value="[[_filterVersion]]">
<input value="{{_filterVersion::input}}">
</vaadin-grid-filter>
One simple way to do filtering that looks at the values of two columns is to not use vaadin-grid-filter, rather just have a input field outside the grid, then filter the array bound to the grid's items property as needed.
<vaadin-textfield on-value-changed="_filterMethod"></vaadin-textfield>
_filterMethod(evt) {
this.gridItems = this.allItems.filter(it => it.col1 !== it.col2);
}
Although I may not fully understand your question as I don't why you are using an input field instead of a button. This filter method approach should work equally well if you call it from a button instead.
I am programming with C# to access data from a range of cells in Excel Spreadsheet.
I can use the following code to access and return the values of range of cells into an object array.
(object[,])Mysheet.UsedRange.get_Value(XlRangeValueDataType.xlRangeValueDefault);
However, I like to find a mean to return all data as strings (exactly as shown on the spreadsheet) into a string array or putting the values as text into the object array. Are there any mechanism to do that>
Did you try using .Text in the Range object? As far as I know, you will have to iterate over each cell and do it for each of them.
Note that .Text is considerably heavy in terms of performance compared to Value or Value2.
And also note that it is also tricky, .Text returns the text as you would see it if you had Excel visible, so if you have a huge number in a column with a short width what .Text will give you is a lot of ####
Sadly I can't think of another way to get it. Usually I get the raw values and format them properly once a get them all, but that assumes that I know which format is used in which cells.
I have a problem when it comes to suming values from a repeated section. Specifically, when I have a repeated section in the orbeon builder with a control that has a value I can easily sum the values of these sections in a different control using sum($control-1) - in the calculated value. When inputing values in the form preview the sum is correct in my control with the summed value.
Unfortunately, when I add a section using the +Insert Below button in the form preview while testing the form the sum() function doesn't work anymore. In the control with this calculated value nothing is shown. Is there a different way to get the sum of values from repeated sections or is this a bug in orbeon?
Once you add a new section while testing the form the sum() function doesn't work anymore, because it adds a empty element to the node-set.
In XPath, when using the sum function, the value of each node is determined by trying to converting it to a number (number()), if there is a empty value, it's gonna convert to NaN, thus in the control with this calculated value nothing is shown by Orbeon.
A different way that would work would be to use the expression like: sum($control-1[text()]) . This way you are testing if the node has content before trying to sum it, so it's always gonna work.