I'm trying to create a graph bar view : My problem is that when I use a fields.function to calculate datas, the values are not right and it seems that the fields.function is not called! But when I use a simple fields.integer, it works fine.
To be sure that my fields.function is correctly defined and the calculation is good, I added it to the form view and it works fine.
Lastly, if I add store=True to the fields.function, it works, but I don't want to store the calculated data in the DataBase.
Thanks for your help.
Well, you had the right idea by storing the value. Unfortunately, right now, it is the only solution.
The way the graph view gets its data is by calling the read_group method in the ORM. That method will collect the data from the database. This means that the aggregation (sum) is done by postgres (and is very fast) instead of being done by the python code (not so fast).
So, right now, the design of the graph view makes it impossible to aggregate functional fields if they are not stored. A possible solution is to add a controller to the graph view. That controller could call read_group itself, then, perform additional requests to the database to aggregate manually on all non stored functional fields. It would probably be much slower, but the additional functionality might be worth it.
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
About This Community
|Asked: 6/3/14, 6:27 AM|
|Seen: 1688 times|
|Last updated: 3/16/15, 8:10 AM|