Skip to main content
Participant
Dec 2, 2021 6:43 PM UTC
Question

Adding a dollar sign to slider expression creates an error.

This is the expresssion that I am using for a slider:

effect("Slider Control")(1).value.toFixed(0)

When I add a dollar sign

"$"+effect("Slider Control")(1).value.toFixed(0)

the expression breaks. What am I doing wrong?

4 replies

Andrew Yoole
Inspiring
Dec 3, 2021 9:11 AM UTC

Martin and Mylenium are correct.  It sounds like you've put the expression on the slider instead of the text.

 

I'm assuming you're just trying to add a $ sign to the front of your slider number, round the number, then put the result into a text layer:

 

Get rid of your existing expressions.  Then add this expression to the "Source Text" parameter of your text layer:

 

"$" + effect("Slider Control")(1).value.toFixed(0)

 

 

 

Translate
Participant
Oct 30, 2025 12:36 PM UTC

Thank you so much for this..

Translate
Mylenium
Legend
Dec 3, 2021 7:20 AM UTC

As Martin indicated, you may simply be using the expression  wrong. More info on what you actually do would certainly help, such as a screenshot of your timeline with the expression...

 

Mylenium

Translate
Mrtn Ritter
Participating Frequently
Dec 2, 2021 8:47 PM UTC

A slider can only take numeric values and "$" is a string.

 

Not sure what you are doing, but if you want "12$" as a text, where 12 is the input from a slider, you need to put this expression to the text, and not to the slider.

 

*Martin

Translate