Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently October 3rd, 2024, 4:31 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: adding array variables
PostPosted: February 24th, 2011, 9:19 pm 
Offline
User avatar

Joined: December 7th, 2010, 11:18 pm
Posts: 4
Location: North Rustico, PEI Canada
Opus: pro 7
OS: vista
System: athalon dual x64 4200+
I am having difficulty adding array variables.
My approach has been to add an array variable in the page properties dialogue. This variable is count()
I have two text input boxes. In the properties dialogue I store the input to variable count(0) and count(1) respectively
I have a text (txt_tot) which displays the variable tot_count. The trigger is key press return, x=(?) tot_count = count(0) + count(1)
But nothing happens :(
I have tried adding the action show txt_tot but to no avail
I am sure that the solution is staring me in the face, please point me to it.


For this message david_g has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: adding array variables
PostPosted: February 24th, 2011, 9:44 pm 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
maybe it's a typo but it's

tot_count = count[0] + count[1]

not curly brackets.

Mack

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
 Post subject: Re: adding array variables
PostPosted: February 27th, 2011, 3:34 pm 
Offline
User avatar

Joined: December 7th, 2010, 11:18 pm
Posts: 4
Location: North Rustico, PEI Canada
Opus: pro 7
OS: vista
System: athalon dual x64 4200+
Thanks for your help but I am still missing something simple. :oops: The task is to create an intereactive web page to determine how to distribute batches of brew-on-premises wines among members who "buy in" in multiples of 30 bottles. e.g. 10 shiraz, 10 barolo and 10 chardonnay. It is easy using excel but that means I have to balance the quantities just because fred changed his mind! The hope is to let them see the consequence of their change. We currently have 10 members and brew 4 times a year.
I attach my humble effort trying to get three numbers ( wine1[0], wine1[1] & wine1[2] ) to add up to wine_tot
I hope the thought of 1200 bottles of wine will inspire your reply. :D


You do not have the required permissions to view the files attached to this post.


For this message david_g has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: adding array variables
PostPosted: February 28th, 2011, 1:15 am 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
Two things:

1. The text box will not pick up the return key action as the input boxes have focus.

2. The contents of the arrays / input boxes are treated as text thus your values would be concatenated rather than added.

I've added a button to handled the totaling, though there are other ways and I've used parseInt to return the whole number value from the input boxes. If you need decimal values use parseFloat.

Regards,

Mack


You do not have the required permissions to view the files attached to this post.

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


For this message mackavi has been thanked by : david_g


Top
 Profile Visit website  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 8 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group