Can I get the length of a stepEntry.value - thymeleaf

I'm iterating over a map in thymeleaf and I was wondering if there is a way to get the length of the stepEntry.value.
The max length of the input field where this value is entered should be equal to the length of this stepEntry.value.
Any help would be greatly appreciated!

why you don't try this way?
<input type="text" th:maxlength="${#strings.length(stepEntry.value)}">

Related

Google sheets: How do I return a text value based on a column matching an entire range?

I need help returning a text value "WIP" based on column A matching an entire range.
The range has digits which users will input that match column A but cells will have more than 1 digit which will be seperated by a comma.
I'm not clear on how to do this so i'm stuck somewhere with:
Sumproduct, isnumber, and match yet i'm struggling how to yield a result.
Could you please help?
Thanks a lot!
Spreadsheet link: https://docs.google.com/spreadsheets/d/1XcIql3ZMymqipZsGUyBk3_ze6LMzjQtHTF-ylGDIT_A/edit#gid=0
Output highlighted in yellow
You can try:
=ArrayFormula(IF(Isnumber(MATCH(A9:A38,FLATTEN(SPLIT(FLATTEN(IF(LEN(G8:M18),G8:M18,)),",")),0)),"WIP",))

How to ignore text/strings in google sheet Sum calculation?

If I have a Text in a sum calculation which I would like to ignore. On the picture below you can see my formula. The text OFF is throwing an error on total hours for me. Any help is appreciated.
Your SUM function is pointless the way you have written it as you're already calculating the result with + and - operators (which is why you get the error). Try:
=SUM(C4,E4,G4,I4,K4,M4,O4)-SUM(B4,D4,F4,H4,J4,L4,N4)
Another approach:
=SUMIF(B3:O3,"End",B4:O4)-SUMIF(B3:O3,"Start",B4:O4)

Limit the importxml to a defined span

Currently I am using a transpose and then another column to count the results and give me what I want. But because Tanaike is awesome and helped me on another section, I am trying to wrap my head around what he did and apply it to this.
Starting with this URL in A1,
https://www.zillow.com/homedetails/307-N-Rosedale-Ave-Tulsa-OK-74127/22151896_zpid/
This is the formula in A2:
=If($A$1:A="","",Transpose(importxml($A1:$A,"//span[#class='snl phone']")))
Based on the listing sometimes there are three phone numbers, sometimes four, and sometimes eight that get spread across as many columns as needed.
I am looking for the Property Owner phone number. This is the ELEMENT from the inspection.
<div class="info flat-star-ratings sig-col" id="yui_3_18_1_2_1506365934526_2361"> <span class="snl name notranslate">Property Owner</span> <span class="snl phone" id="yui_3_18_1_2_1506365934526_2360">(918) 740-1698 </span> </div>
So I tried this, and it comes up content is empty. I was thinking to look at the div class info flat, then within that the snl phone, and stop before the /end of span.
=importXML(B17,"//div[#class='info flat-star-ratings sig-col']//span[#class='snl phone']/#span")
What I really need is ONLY the property owner phone number with 95% or greater accuracy.
How about this modification of XPath query?
Modified XPath query :
=importxml(A1,"//div[#class='info flat-star-ratings sig-col']//span[#class='snl phone']")
Result :
If this is not data you want, I'm sorry.
Edit :
4th and 8th number are the same. Is my understanding correct? If it's no problem. Please put URL and a following formula to "A1" and "A2", respectively.
=QUERY(ARRAYFORMULA(IF(IMPORTXML(A1,"//div[#class='info flat-star-ratings sig-col']//span[#class='snl name notranslate']")="Property Owner",IMPORTXML(A1,"//div[#class='info flat-star-ratings sig-col']//span[#class='snl phone']"), "")),"Select * where Col1<>''")
Result :

Showing float numbers Grails in gsp

I want to manipulate float numbers in gsp, here is what i want:
If the number has a 1.* i want it to show the dot, but if it ends with zero i dont want it to show the dot and zero.
like this:
Score: 1.5
Score: 1
Score: 2.1
Score: 3
The score variable is a float number and it is an input field on the gsp that loads the number and it can be changed.
But the real problem is, how can i see if the number has decimals?
There is already a taglib for formating numbers: (g:formatNumber)
I think something like this should work:
<g:formatNumber number="${score}" type="number" format="###.##"/>
But...if that doesn't work...
I would say write your own custom taglib. If it is something that is going to be used multiple times, why loop through a list of objects in your controller, change the float to a string just to display it? Let the page decide how to show it in the proper context.
Or
Add a transient field to the domain object (String scoreDisplay) and then have getScoreDisplay() return the value of score as a string, formatted how you want.
Well, I'd suggest you to format the number in your controller - before it gets to your gsp. That way you have more control over the number format. Once you're in the gsp, you have to use a grails' decimal number format or make your own taglib to format (since the number of fractional digits changes in your case).

integer digit grouping in grails scaffolded views

I have a default scaffolded view and in the list view, all my integer values are shown with digit grouping. (like 5,129)
I couldn't find a way to disable this behavior. I tried on both English and Turkish locale. I am not sure if it is used but the messages.properties file is all default values:
default.date.format=yyyy-MM-dd HH:mm:ss z
default.number.format=0
If I change the view and add g:formatNumber around the value such as
<g:formatNumber number="${fieldValue(bean: tagInstance, field: 'tag_id')}" type="number" groupingUsed="false" />
all that gets printed is 5 (for the number 5129)
Eliminating the fieldValue() call fixed it.
${tagInstance.tag_id}
prints the number without any formatting.
Have you tried this:
default.number.format=#
Note that the # will cause a value of 0 to not display. If you want it to display, you'll probably want:
default.number.format=#0

Resources