On Tuesday, April 16, 2019 at 5:54:54 AM UTC-7, learth...@gmail.com wrote:
>
> [skipping to what caught my eye first] 
>
Then I tried to do it by referring to what I found in the web2py manual. 
>
> That’s where I am now. This is only for the price but it’s the same for 
> the delay.
>
>  
>
> partid = db().select(db.parts.id)
>
>                for i in partid:
>
>                 query = db.supplierchoice.parts == i
>
>                rows = db(query).select(db.supplierchoice.parts, 
> db.supplierchoice.supplier, db.supplierchoice.price.min())
>
>                 response.flash = rows
>
>  
>
> I tried to show the result in a response.flash message before performing 
> an update of the fields best_price and best_delay of the table spare_parts 
> to avoid breaking everything but it shows me something that looks nothing 
> good.
>
> Depending on the tests, I get two different results: either web2py is KO 
> or my response.flash is very strange.
>
> Thank you both for taking the time to answer me even though I did not have 
> much detail.
>
>  
>
> Arthur
>

I would expect response.flash to look a bit strange in 2 ways:  a Rows 
object is not a simple string or number, but will  display as a conversion 
to string, something like
supplierchoice.idsupplierchoice.productnamesupplierchoice...
 
1                        long name of                         10
                         product

(I was expecting json format, but it appears the pretty printer is used)

And then you set response.flash in the for loop, but it isn't returned 
until after the for loop is done, so it will only show the last result.

/dps

 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to