[web2py] Re: How can I update the record in one table with value entry of another table as soon as the value is entered?

2019-09-12 Thread villas
Well done for getting it working... We're all learning from each other here! :) On Thursday, 12 September 2019 12:27:27 UTC+1, mostwanted wrote: > > Sorry @villas its just a bad habit that i have somehow over time gotten > used to but i will heed your advice, thank you. > > Mostwanted > > On

[web2py] Re: How can I update the record in one table with value entry of another table as soon as the value is entered?

2019-09-12 Thread mostwanted
Sorry @villas its just a bad habit that i have somehow over time gotten used to but i will heed your advice, thank you. Mostwanted On Thursday, September 12, 2019 at 12:43:29 PM UTC+2, villas wrote: > > for item1 in item1: > > I mentioned this to you before -- please do not do this! > It is a

[web2py] Re: How can I update the record in one table with value entry of another table as soon as the value is entered?

2019-09-12 Thread mostwanted
Thank you everyone for your input, i was finally was able to solve my problem, i added these two lines & erased everything else (smile) & it worked like a charm. diff=db.product(key).amount-value db(db.product.id==db.product(key).id).update(amount=diff) The whole code: total =

[web2py] Re: How can I update the record in one table with value entry of another table as soon as the value is entered?

2019-09-12 Thread villas
for item1 in item1: I mentioned this to you before -- please do not do this! It is a really bad practice which will cause terrible problems for you. For example, do this instead: for i in item1: Best wishes for your program. -- Resources: - http://web2py.com - http://web2py.com/book

[web2py] Re: How can I update the record in one table with value entry of another table as soon as the value is entered?

2019-09-11 Thread Dave S
On Tuesday, September 10, 2019 at 2:54:43 AM UTC-7, mostwanted wrote: > > I figured if I could update the amount field in db.product within the buy > functiontion just around the same time i'm saving inside the db.sale table > when purchasing then it should be easy but I am having a really

[web2py] Re: How can I update the record in one table with value entry of another table as soon as the value is entered?

2019-09-10 Thread mostwanted
I figured if I could update the amount field in db.product within the buy functiontion just around the same time i'm saving inside the db.sale table when purchasing then it should be easy but I am having a really hard time identifying only the purchased items by their ids & subtracting their

[web2py] Re: How can I update the record in one table with value entry of another table as soon as the value is entered?

2019-09-08 Thread villas
Sorry to hear you are struggling with this. vat=round(total*0, 2) The above line would always produce: vat == 0.0 which doesn't seem intentional. text=int(request.vars.name) To make your program more robust, I suggest using try...except to catch any errors in the above line. -- Resources: -

[web2py] Re: How can I update the record in one table with value entry of another table as soon as the value is entered?

2019-09-05 Thread isi_jca
Hi!!!, When you made a sale, only must to update the products sold. For example: db(db.product.amount.id = product_id ).update(amount=amount1) El jueves, 5 de septiembre de 2019, 15:04:57 (UTC-3), mostwanted escribió: > > Everything you are saying i understand but I cant put into

[web2py] Re: How can I update the record in one table with value entry of another table as soon as the value is entered?

2019-09-05 Thread mostwanted
Everything you are saying i understand but I cant put into code, every attempt I have made at this all day today just up on traceback-flames! I am recording sales made into the sales db through the buy function: def buy(): if not session.cart: session.flash = 'Add something to

[web2py] Re: How can I update the record in one table with value entry of another table as soon as the value is entered?

2019-09-05 Thread Dave S
On Wednesday, September 4, 2019 at 10:59:21 PM UTC-7, mostwanted wrote: > > I have a website where I am selling items, what I desperately want to > achieve is to be able to show the buyers the remaining number of each item. > I have 2 tables, the table that has all the items being sold & has a