-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

This is not stricly about Hobo. I recommend you read some of the theory
behind the Model-View-Controller in Rails, I think it can help you.

For example, you can make customise the Hobo show action in the
controller, something like this:

def show
  @records = Model.find(:all, :conditions => "date > '2011-01-01'")
  @amount = @records.sum(:cant)
  hobo_show
end

And then you have access to @amount in the view :).

Regards,
Ignacio

El 25/08/11 21:16, Enrique Moreira escribió:
> 
> Hello Ignacio 
> Yes. Its works Fine!! Thanks! sum very wellnow one question more please:
> The model:
> ProgresoIndicators.rbfecha:datecant:decimal---How to select a range of dates 
> ? on the View?? to sum cant partialuse two select dates put on the  View of 
> Plan_operativo?
> Regards
> Enrique
> 
> 
>> Date: Thu, 25 Aug 2011 19:13:44 +0200
>> From: [email protected]
>> To: [email protected]
>> Subject: Re: [Hobo Users] Re: FW: Sum a atributte on collection tag Not 
>> ideas?
>>
> Hi Enrique,
> 
> Why don't you try to make a virtual field in the PlanOperativo model and
> sum it there?
> 
>   def total
>     progreso_indicadors.sum(:cant)
>   end
> 
> 
> And later you can call the table-plus:
> 
> <table-plus fields="total"/>
> 
> or maybe you just want something more simple:
> 
> <this.total/>
> 
> 
> 
> About using custom Ajax forms to make a query and return a result I
> recommend you this manual: http://cookbook.hobocentral.net/manual/ajax.
> Ajax is a bit crazy when you start but with a lot of Firebug and
> patience you can certainly make it :)
> 
> 
> Regards,
> Ignacio
> 
> El 23/08/11 18:49, Enrique Moreira escribió:
>>>>
>>>> Hello Ignacio
>>>> this is mi trouble:i have a tree tables
>>>> Proyectos.rb   proyecto:string--has_many: 
>>>> plan_operativos-----------------------Plan_operativo.rb fecha:date  
>>>> cant:decimal--belongs_to: proyectohas_many: progreso_indicador
>>>> --------------------------------------
>>>> Progreso_indicador.rb   fecha:date   cant:decimal---  belongs_to: 
>>>> plan_operativo
>>>> i put the next lines on application.dryml:----------------------------<def 
>>>> tag="card" for="PlanOperativo"><card class="plan-operativo" 
>>>> param="default" merge><header: param>    <h4 
>>>> param="heading"><a><name/></a> : <view:cant/> : 
>>>> [<view:indicador.unidadcl.unidad/>]</h4>   </header:><body: param><ht 
>>>> key="progreso_indicador.collection.count" 
>>>> count="&this.progreso_indicadors.size"><count:progreso_indicadors 
>>>> param/></ht><div><table-plus:progreso_indicadors fields="this,cant" 
>>>> without-search-form><progreso_indicador-heading:>Fecha</progreso_indicador-heading:><cant-heading:>Cantidad</cant-heading:></table-plus>
>>>>  <div>total:   <!--<table-plus fields="progreso_indicadors.sum(:cant)"/> 
>>>> -->  <---HOW TO SUM_? shoeme error cant convert string to integer!!  
>>>> </div>  </div>  </body:>    </card></def>-------------------------
>>>> The render works fine!
>>>> a) i need a sum of  Progreso_indicadors.cantb)  -- between dates?    put 
>>>> two select dates ?
>>>> c) One New Form with Nested Select Boxes..ajax style? alternatively?      
>>>> -Select Proyects       1- Select Plan_Operativos One or Selected Plans [x] 
>>>> checkboxes?       or / and       2-Select dates Ranges or ALL      3. 
>>>> Display a table-plus with SUM results on bottom
>>>>
>>>> Any idea?
>>>> Best Regards Enrique
>>>>
>>>>                                      
>>>>
> 
>>
- -- 
You received this message because you are subscribed to the Google
Groups "Hobo Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/hobousers?hl=en.
>>

- -- 
Ignacio Huerta Arteche
http://www.ihuerta.net
Teléfono: 0034 645 70 77 35
Email realizado con software libre
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk5XOy8ACgkQBPlUJ6RHaOSuaQCeMSX8K3sPS4P8shdLccr6qe5D
zgcAoIfJzgD2GePDkiakDVJcuShg48Sg
=Qm0H
-----END PGP SIGNATURE-----

-- 
You received this message because you are subscribed to the Google Groups "Hobo 
Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/hobousers?hl=en.

Reply via email to