Skip to main content
Solved

Cannot assign variable that is resolved as FLOAT to text node via API

  • February 22, 2024
  • 1 reply
  • 359 views

Calin_Stefanescu

I have a list of variables that I want to apply to text nodes. These variables are numbers. I want to do it via API because there are a lot of them. The problem is that when I try to bind these variables using the “node.setBoundVariable” function, the resolved type for the variable is “FLOAT” and not “STRING”, which is correct, but this prompts the error : “in setBoundVariable: variable of resolved type ‘FLOAT’ cannot be bound to this field”. I undestand that the text node was expecting a string but I can bind the number variable to text manually in the software and I even have a scoping section for “text” when opening the options for the number variable.

Best answer by djv

Hey @Calin_Stefanescu, thanks for reaching out!

This is actually an intentional product limitation. The UI supports binding number variables to text content, because we can have a stringify expression behind the scenes. But since expressions can’t be used for binding in general, the plugin API doesn’t expose expressions, only direct aliases.

This topic has been closed for replies.

1 reply

djv
Figmate
  • Community Support
  • Answer
  • February 23, 2024

Hey @Calin_Stefanescu, thanks for reaching out!

This is actually an intentional product limitation. The UI supports binding number variables to text content, because we can have a stringify expression behind the scenes. But since expressions can’t be used for binding in general, the plugin API doesn’t expose expressions, only direct aliases.