Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

Adding a chase button

Darren22
Tera Expert

Good evening,

I have been asked to develop a UI button to allow the service desk to update a call to show its been chased.

What they would like is a field that starts at 0 and everytime the button is clicked it increases by 1.

So I have a field names u_chase and so fare I have managed to get the button to appear all fine. I have also managed to set the field to a random value everytime the button is clicked.

The issue I have is that if the value is set to 1 and I click the button the new value becomes 11 and then 111. So its almost as though my script is seeing it as a string rather than integer?

Any idea what script I can use.

1 ACCEPTED SOLUTION

stevenfroggattk
Tera Guru

Hi Darren,

You'd need to use something like this:

current.u_chase = parseInt(current.u_chase)+1;
current.update();

Hope this helps.

Thanks

Steve

 

View solution in original post

3 REPLIES 3

Tony Chatfield1
Kilo Patron

Hi, Not sure if relevent but I recently found similar behaviour with myValue += newValue;
and resolved it with myValue = myValue + newValue;

Jason Kuhar
Tera Contributor

You will need to capture old value before increment and store it within the table record.

 

var a = table.newfield; - default to 0

var b = 1;

var c = a+b

table.newfield = c

Onclick(c)

stevenfroggattk
Tera Guru

Hi Darren,

You'd need to use something like this:

current.u_chase = parseInt(current.u_chase)+1;
current.update();

Hope this helps.

Thanks

Steve