Skip to main content
Participant
December 2, 2021
Question

Adding a dollar sign to slider expression creates an error.

  • December 2, 2021
  • 3 replies
  • 6511 views

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?

3 replies

Andrew Yoole
Inspiring
December 3, 2021

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)

 

 

Participant
October 30, 2025

Thank you so much for this..

Mylenium
Legend
December 3, 2021

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

Mrtn Ritter
Participating Frequently
December 2, 2021

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