Global text variables with calculated value broken when used in other formulas

Let's say you have this global texy variable

MyVariable = $bi(temp)$°$wi(tempu)$

And I want to incorporate it in another text box

$tc(n2w, gv(MyVar))$

The editor shows literal value of the variable ( $bi(temp)$°$wi(tempu)$) , yet the actual wallpaper shows the expected "thirty-five°C"

How do I get around this?

This is likely a bug, did you try to do $tc(n2w, "" + gv(MyVar))$

Hi Frank,

I can confirm this.

Komponent Global

Value = (text)

$rm(fsused, int)/rm(fstot, int)*100$

The Komponent Value Text Preview shows 77.36879 (correct).

The actual wallpaper shows the correct value too.

Now we use $gv(Value)$ in a progress bar inside the Komponent, but it shows the literal formula as the Text Preview (see Vysor screenshot, attached)

Also, whilst the wallpaper in reality shows the correct value, the preview screen in the KLWP editor shows zero (probably as text is an illegal numeric value so is default to 0?)

I would guess that the core code is fine, but there's a bug *within* the editor that is failing to spot formulae and failign to evaluate them in preview contexts.

All the best, Tim Watts

PS - KLWP ROCKS!!! Yes I paid :) It is extremely powerful and very solid.

??? I just went back and looked again and it fixed itself? Both the preview graphics and the Text Preview box are now showing the computed answer, not the literal formula

OK - perhaps no bug or a very edge case one.

Got it!!!

First time you set up a Komponent, it shows this bug.

Exit the app and restart app, and it works perfectly.

HTH

Tim

Another bug related to this is that if you inherit a global text from a main component with a function and you link a text global in a subcomponent (same and different name) to the main component, the formula is inserted as text instead of it being calculated

main component
- global text <name> = $df(YYYY)$

subcomponent
- global text <name1> = (inherit <name> from parent)
- global text <name2> = $gv(name1)$ => shows as $df(YYYY)$

Even after save, close and reopen

Expected behavior: get the value of <name> in <name1> and <name2>

Thanks for checking

I hope someone can confirm this bug. I stumble on this many times to transfer data between components.

I was currently creating some dynamic colors in root (via text fields because color fields won't accept calculations), but can't transfer them to my sub component now :/

I hope there is a fix for this in the next release. It's a real dealbreaker for me. I don't want to copy paste all globals in every subcomponent. :)

I tried this option, but it didn't work.

I used the wrong thread. I was testing the sub components

This has been fixed in 3.30, it happened ONLY on global lists referenced by index like $gv(mylist, 0, 2)$

This bug still exists as Tim Watts explained, making it impossible to transfer a text variable's value to another komponent.

I am also experiencing this bug in the following way:

In root, I have global variables that pick a color, for example, the following:

GV1 = $if(wi(temp) > 50, #FF0000FF, #FFFF0000)$

GV2 = $ce(gv(GV1), sat, 50)$

For the wallpaper I am making, I want to pass these variables to a komponent that is also in root. Inside the komponent, I make variables, set them to global, and link then to the root variables. Rather than the output of the formula, I get the formula itself ($if(wi(temp) > 50, #FF0000FF, #FFFF0000)$ for GV1 and $ce(gv(GV1), sat, 50)$ for GV2), rendering the global unusable.

I'm not sure if this affects anything from an efficiency standpoint, but if I want to change the formula, I have to change it both in root and in the komponent (since I can't use the global function).

Unfortunately, even if I exit the app and restart, the bug persists.

@Libnanian This is the same problem I described below and there is another thread that I opened with this explination. It has been confirmed in that thread, but I think it is not high on the priority list or it is difficult to solve. I'll check if I can find that thread.

https://help.kustom.rocks/i482-global-text-variables