Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
ssk
Level 1
Level 1
First reply posted First question asked Welcome!

Hello all, 

I'm trying to fetch a signal which is a string in nature using Java script. When I use .value to fetch the value it is returning 0 even if the signal value is provided and it is verified using the signal tree.

Added the section of the code used. Any support will be appreciated. 

 

//Inputbuffer is the Char signal created in oneeye

var LocalVar=new JsSignal("Inputbuffer");

dataArray= LocalVar.value;

oneeye.log(dataArray);

0 Likes
1 Solution
Jeremy_Z
Moderator
Moderator
Moderator
250 sign-ins 100 likes received 750 replies posted

Hi @ssk ,

Thanks for your reply.
In my opinion, the issue may be related to the OneEye Configuration file.
Firstly, I'd highly recommend you open a OneEye Configuration file prior to editing the script, next, it provides some OneEye demos for you to refer to and further develop.
BR,
Jeremy

View solution in original post

0 Likes
5 Replies
Jeremy_Z
Moderator
Moderator
Moderator
250 sign-ins 100 likes received 750 replies posted

Hi @ssk ,

Please try the below code to retrieve the current value of the signal.

var LocalVar = new JsSignal("Inputbuffer");
var dataArray = LocalVar.getValue();
oneeye.log(dataArray);

BR,

Jeremy

0 Likes
ssk
Level 1
Level 1
First reply posted First question asked Welcome!

Hello Jeremy,

Thanks for the quick reply. I'm getting a error stating getValue is not a function.

"TypeError: Property 'getValue' of object JsSignal(0x176295f0) is not a function"

Regards,

Siva

0 Likes
Jeremy_Z
Moderator
Moderator
Moderator
250 sign-ins 100 likes received 750 replies posted

Hi @ssk ,

Whether you ever try to get the value of a float or int variable via the above code, I guess it's related to the string type.

BR,

Jeremy

0 Likes
lock attach
Attachments are accessible only for community members.
ssk
Level 1
Level 1
First reply posted First question asked Welcome!

 

Hello Jeremy,

I have declare the signal as Char, and the data entered is shown in the image below.

Let me know if I made any mistake.

Regards,

Siva

0 Likes
Jeremy_Z
Moderator
Moderator
Moderator
250 sign-ins 100 likes received 750 replies posted

Hi @ssk ,

Thanks for your reply.
In my opinion, the issue may be related to the OneEye Configuration file.
Firstly, I'd highly recommend you open a OneEye Configuration file prior to editing the script, next, it provides some OneEye demos for you to refer to and further develop.
BR,
Jeremy

0 Likes