New topic: 

Adding Figures

<http://forums.realsoftware.com/viewtopic.php?t=37962>

         Page 1 of 1
   [ 5 posts ]                 Previous topic | Next topic          Author  
Message        S.Rampling          Post subject: Adding FiguresPosted: Sun Mar 
06, 2011 1:00 am                         
Joined: Sat Jan 08, 2011 4:47 pm
Posts: 148
Location: Sydney, Australia                Not quite sure how to explain what I 
wish to do, but here goes.

I wish to add a group of prices eg $4.00 + $5.00.

Do I declare these as integers and would I do something like.
Code: txt1.integer = "4"
txt2.integer = "5"

They will be textboxes that save there data to the db and are then added 
together at the end of the column of textboxes.
for example.

The code is for a simple inventory of parts, the total will be how much has 
been out laid so far.

Thanks Shane.      
_________________
Thanks to any and all who can help with my limited knowledge of Real Studio.
54YO Kart Racer from Sydney Australia
Real Studio 2010r5.1 Win 7  
                             Top                 IMIXMMM          Post subject: 
Re: Adding FiguresPosted: Sun Mar 06, 2011 1:52 am                         
Joined: Thu Oct 26, 2006 4:49 am
Posts: 270                Hi Shane,

I think you mean you want to add Product Items to something, Like a product 
list?

If So. 

You will need a "MASTER" table to hold ItemCode, Description, UOM, PriceEach 
etc if these items are regularly used
Then you will need to present a listbox with the columns to show this 
You will need some way of adding, changing and deleting these items
As you add each item, a total cost/price will appear somewhere

And you will then need to STORE these items with your record, So you will need 
another table that has the same fields ( except for maybe the description field 
as that can be "Looked Up" via a relationship. This table will need an extra 
field called RelatedRecord Id so the items now which record they belong to.

Is this what you mean?

Or something simpler where there is no MASTER TABLE and the user just types in 
Item code,  And/Or description along with the price. but still using a listbox?

Regards

Dave M   
                             Top                S.Rampling          Post 
subject: Re: Adding FiguresPosted: Sun Mar 06, 2011 2:19 am                     
    
Joined: Sat Jan 08, 2011 4:47 pm
Posts: 148
Location: Sydney, Australia                Hi Dave, thanks for your response.

What I want to do is, the user types in say for instance a Yamaha engine in one 
textbox and the price he paid for it in a textbox next to it, next line down he 
types in say a new muffler system in another text box and the price next to it. 
as follows..

Yamaha KT100S  $1200
Muffler       $140

Total       $1340

I wish to be able to calculate the totals, as the Parts and prices will be 
stored in the DB, but I'm not sure how to go about it, I have sorted out my DB 
and other probs with alot of help from Tim Hare, but am stuck so far on this 
one.

Thanks Shane.      
_________________
Thanks to any and all who can help with my limited knowledge of Real Studio.
54YO Kart Racer from Sydney Australia
Real Studio 2010r5.1 Win 7  
                             Top                 IMIXMMM          Post subject: 
Re: Adding FiguresPosted: Sun Mar 06, 2011 2:24 am                         
Joined: Thu Oct 26, 2006 4:49 am
Posts: 270                Hi Shane,

READ my post Slowly!

I gave you 2 ways you could do it.



Dave M   
                             Top                jefftullin          Post 
subject: Re: Adding FiguresPosted: Sun Mar 06, 2011 3:35 am                     
            
Joined: Wed Nov 15, 2006 3:50 pm
Posts: 2173
Location: England                If the text boxes that hold the values have 
different names, then the sum has to be done by adding the values one by one:

dim dfTotal as double
dfTotal = val(value1.text)
dfTotal =dfTotal +val(value2.text)
dfTotal =dfTotal +val(value3.text)
.etc

txtTotal.text = format(dfTotal,"0.00")



better would be to make the value text fields an array.
then you can use a loop to add them

dfTotal = 0
For x = 0 to ubound(txtValue) - 1
dfTotal = dfTotal + val(txtValue(x))
next


You will run into problems if you do not mask the value fields somehow: imagine 
if someone types 'free' into one of them.

If the data is already in the database, and you retrieve (x) values to display 
on screen, you can get the data like this:

select description, value  from orders where customer = 'BLACK';

and you can have the database add it up for you in advance like this:

select  sum(value)  from orders where customer = 'BLACK';   
                             Top             Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 5 posts ]      
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to