Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


Help with running CSV data into Speedometer

New Here ,
May 28, 2021 May 28, 2021

Copy link to clipboard

Copied

I'm back. I have more problems I can't solve yet.
I have a speedometer gauge slaved to a slider controller effect. I recieved help for getting the gauge and slider synced up properly and that's working wonderfully.
My next step was to see if I could also add an expression to the slider that could allow me to animate it with speed data from a csv.
I generally have found some expressions to work csv data through the gauge rotation or the digital dial's number, but I was really hoping to keep all controll and stuff in one layer; in this case the controller layer with the slider. 

I entered in the following expression to try and run the data on the slider:

Slider=effect("Slider Control")("Slider")

a=Math.round(time*30)

valueOf(Slider)=footage("Speed_Data.csv").dataValue([0,a])

But I get a syntax error. No doubt relating to the left hand valueOf(Slider). I would like it so that the csv data overrides the slider with its values when the expression is active. I added a picture of the csv file as well just in case I'm formatting everything wrong.



Capture.PNGcsv data.PNG
Here is my thought process. I am making a template that later myself or my coworkers can use to either animate the gauge via slider keyframes, or plug in csv speed data to make the gauge move. It would be easier to use if everything is controlled through the slider more or less.
Thanks in advanced for any help.

TOPICS
Error or problem, Expressions, How to, Scripting, User interface or workspaces

Views

235

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
May 28, 2021 May 28, 2021

Copy link to clipboard

Copied

Indeed there is no valueOf(Slider) and hence your code doesn't make a lick of sense. The rest isn't really clear. Completely overriding the slider would either require the slider to be animated to zero and then do a slider + value from CSV or have an if()else{} somewhere in there that completely toggles either the slider only or the CSV data only. Furthermore, you could even modulate the CSV data with an envelope curve from the slider using a linear() expression or similar, which likely would be what you would want, anyway, as randomly toggling from the slider to the data would cause jumps. Similarly, picking actual data values from the CSV using a slider would be another thing. Anyway, it's really not clear what you actually want/ need here. You need to clarify.

 

Mylenium

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 01, 2021 Jun 01, 2021

Copy link to clipboard

Copied

Hey thanks for the reply. I am new to code so I'm not sure what I need to do to get the results I had in mind. I'm making a template so that when my coworkers and I use it we can either animate with keyframes from the slider, or (if there is csv speed data available) instead use the csv data to animate the gauge. It would be a one or the other situation. I am not looking to use both at once. I wanted to do it through the slider layer because I was trying to keep all the controlls for the gauge on one layer for sort of a top down approach. Instead of writing expressions for the gauge needle. To my untrained eye, all the options you mention are very similar so I don't know if one option you gave is better for me than the others. I think the first option you gave if()else{} seemed to makes sense. The very last option also seems to be really useful. 
Im assuming the if else statement will say if there is csv data, then use it. else use the slider? and the last option im not sure if you are saying that the slider inherites the values of the csv data directly but that sounds good. 
I appreciate the help.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jun 01, 2021 Jun 01, 2021

Copy link to clipboard

Copied

Yes, a simple

 

if (myData.length != 0)

{use data}

else

{use slider}

 

could do the trick. Of course you need to fill in the actual references in that bit of pseudo-code. You could also control it via a checkbox control somewhere to make it explicit.

 

Mylenium

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 02, 2021 Jun 02, 2021

Copy link to clipboard

Copied

I think I understand the if else statement now. But how do I get the csv data to run through the slider the first place? I was trying:
=footage("Speed_Data.csv").dataValue([0,a])

i want the a variable to be the rows. i want after effects to run all items in the 0 column. how do i write the expression?

 

I get a data file: Invalid node index, 116 child nodes present for nodes at path item: 1. Input index: 116

 

the csv file i have has 116 rows and a single column. 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jun 02, 2021 Jun 02, 2021

Copy link to clipboard

Copied

LATEST

There is no need to run it through any slider. You can just link the column directly to the text and AE will fetch a new value for every frame. the expression would then merely be a fallback option if there is no data, reverting to whatever the slider value is.

 

Mylenium

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines