Syntax help?

I've a num variable

> input(name: "existingTileFontSize", type: "num", title: "HTML Tile Font Size (%)*", defaultValue: 100)

I want to do math on it in a string

> "<h1 style='font-size:(${existingTileFontSize}*.75) %;'>${seasonName}</h1></div></div>"

everything is fine until I apply multiple by .75.
Can I get an example please?


“ <h1 style='font-size:(${existingTileFontSize*.75}) %;'>${seasonName}</h1></div></div>“

unexpected token: 75 @ line 310, column 486.
care to see the whole line?

Column 486, dang how long is that line? :rofl:

Try 0.75, maybe? Assuming you're trying to multiply existingTileFontSize by this value.

1 Like

Still not succeeding :frowning: I'm just trying to introduce a variable that 'weights' the overall user value entered. The code below works btw. I just want to add a .75 reduction so if the user enters 100, the actual value is .75 . I think I may be trying to do math on a string and not an integer. What is the syntax to convert a string to int?

here is the offending code :

attribute "tileFontSize", "number"

input(name: "existingTileFontSize", type: "num", title: "HTML Tile Font Size (%)*", defaultValue: 100)

def tileFontSize() {
tileFontSize = 100
if(existingTileFontSize > " ") tileFontSize = existingTileFontSize
sendEvent(name: "Tile Font Size", value: tileFontSize)


sendEvent(name: "seasonTile", value: "<div style='background-image: url(${iconPath}${seasonName}.svg);background-position: center;background-repeat: no-repeat;background-size: contain;width: 100%;height: 100%;'><div style='font-family: Georgia, serif;text-align: center;position: relative;top:${existingTileVertWordPos}%;font-size:${existingTileFontSize}%;color:${existingTileFontColor};text-transform: uppercase;font-style: oblique;'><h1 style='font-size:${existingTileFontSize}%;'>${seasonName}</h1></div></div>", descriptionText: descriptionText)

Download the Hubitat app