Skip to main content
New Participant
August 11, 2020
Question

How to formulate custom calculation script (if this is even possible).

  • August 11, 2020
  • 1 reply
  • 690 views

I'm creating an interactive worksheet for a friend. 

This worksheet has 3 shapes on it: a square, circle, and triangle. As well as a 24 Hour vs day of the week chart. 

 

He wants there to be a custom entry in each shape that will also auto-populate as 3 selections in a dropdown menu for each hour slot. These 3 options will need to be calculated back as hours spent in each shape. 

 

This is what it currently looks like 

 

It uses:

 

var total = 0;

for (var i=1; i<=168; i++) {

if (this.getField("M1."+i).valueAsString=="Square") total++;

}

event.value = total;

 
Is there a way to make the "Square" value match whatever is in field "Text10" ?
 
This topic has been closed for replies.

1 reply

try67
Community Expert
August 11, 2020

Since I wrote the code for you I feel obliged to add that the drop-downs have the same export values for all items, which is why it's not working. You have to give each item a unique export value, or stop using them at all.

IlikeamyAuthor
New Participant
August 11, 2020

It works now after I removed the export values, but I wanted to add/change an additional variable if that makes sense?