Help forum

Change text color based on calculation (API Data)

  • Xioteer

    2 years ago

    Hiho,

    I think I am being a bit of a dummy right now, but can't really figure it out. Maybe need a nudge in the right direction.

    I want to change a style based on a calculation with data coming from an API.

    I have two classes. negative and positive. All that has to change is the color of the text.
    The calculation and conditional are in the screenshot.

    There are also the classes in the style with the respective color changes.

    But nothing happens.

    Tried the Docs with AI, but I seem to miss something here..
    1248372305332011038-image.png
    1248372305634267257-image.png
  • Mr

    2 years ago

    Try use number formula after item. Maybe string not detected amount? Not sure but worth try
  • Mr

    2 years ago

    Or delete if nodes just use greater or equal
  • "If"
  • Xioteer

    2 years ago

    ohhh, Yeah I was wondering whether I was actually doing a doubling there.
    probably because I started from the if and then found the greater than.

    New version works great.

    Just the second row in the table is somehow not registering correctly for whatever reason. Everything else works!

    It looks like the IF's output was "true" (string) and the greater than is outputting an actual true boolean value.
    1248377184368984084-image.png
    🎉1
  • Thanks @Mr !
  • Max

    2 years ago

    Hi @Xioteer! The issue here is the variable type. Both inputs are recognized as string. You need to convert them individually to a number with the "Number" node. Then it should work fine 😊
  • Xioteer

    2 years ago

    Did that and works as intended! Thanks so much!

    Will keep looking out for the type in the future.
    👍1