Viewing 3 reply threads
  • Author
    Posts
    • #7293
      tronseba
      Participant

      Hi, I’m having issues with nested addmore groups. I define it properly but piklist reder it as different groups fileds of main group and not as nested fields groups. Also save it in the satabase as separate fields arrays.

      this is my group field code:

      piklist('field', array(
      'type' => 'group'
      ,'field' => 'objetivos'
      ,'label' => 'Objetivos'
      ,"add_more"=>true    
      ,'columns' => 12
      ,'description' => __('Defina los objetivos a los que aplica esta tabla')
      ,'fields' =>array(
                                   array( "type"=>"select"
                                        ,"field"=>"obj_nutricion"
                                        ,"label"=>"Objetivos Nutricion"
                                        ,'columns' => 6
                                        ,'choices' =>$obj_nutricion)
          
                                  ,array("type"=>"group"
                                        ,"field"=>"comp_corp"
                                        ,"label"=>"Composicion Corporal"
                                        ,"add_more"=>true
                                        ,'columns' => 10
                                        ,"fields"=>array( 
                                                  array("type"=>"group"
                                                   ,"field"=>"general_cc"
                                                   ,"label"=>"Obj General"
                                                   ,"add_more"=>true
                                                   ,'columns' => 10
                                                   ,'fields' =>array(
                                                                      array( "type"=>"select"
                                                                            ,"field"=>"general_cc_obj"
                                                                            ,"label"=>"Objetivo"
                                                                            ,'columns' => 10
                                                                            ,'choices' =>$obj_corp_gral
                                                                           )
                                                                     ,array("type"=>"select"
                                                                            ,"field"=>"focus_gral_cc"
                                                                            ,"label"=>"Focus"
                                                                            ,'columns' => 2
                                                                            ,'choices' =>$focus)
                                                                     )
                                                      )
      
                                                 ,array("type"=>"group"
                                                   ,"field"=>"especifico_cc"
                                                   ,"label"=>"Especifico"
                                                   ,"add_more"=>true
                                                   ,'columns' => 10
                                                   ,"fields"=>array(
                                                                      array( "type"=>"select"
                                                                            ,"field"=>"zona_cc_esp"
                                                                            ,"label"=>"Zona"
                                                                            ,'columns' => 8
                                                                            ,'choices' =>$obj_corp_esp_zona)
      
                                                                     ,array( "type"=>"select"
                                                                            ,"field"=>"objetivo_cc_esp"
                                                                            ,"label"=>"Objetivo"
                                                                            ,'columns' => 8
                                                                            ,'choices' =>$obj_corp_esp_obj)
      
                                                                     ,array("type"=>"select"
                                                                            ,"field"=>"focus_esp_cc"
                                                                            ,"label"=>"Focus"
                                                                            ,'columns' => 2
                                                                            ,'choices' =>$focus)
                                                                   )
                                                     )
      
                                          )
                                      
                                      )
          
                                  ,array("type"=>"group"
                                        ,"field"=>"rend"
                                        ,"label"=>"Rendimiento"
                                        ,"add_more"=>true
                                        ,'columns' => 12
                                        ,"fields"=>array( 
                                              array("type"=>"group"
                                                   ,"field"=>"especifico_rend"
                                                   ,"label"=>"Especifico"
                                                   ,"add_more"=>true
                                                   ,'columns' => 10
                                                   ,"fields"=>array(
                                                                      array( "type"=>"select"
                                                                            ,"field"=>"zona_rend_esp"
                                                                            ,"label"=>"Zona"
                                                                            ,'columns' => 8
                                                                            ,'choices' =>$zonas_esp_rend)
      
                                                                     ,array( "type"=>"select"
                                                                            ,"field"=>"objetivo_rend_esp"
                                                                            ,"label"=>"Objetivo"
                                                                            ,'columns' => 8
                                                                            ,'choices' =>$obj_esp_rend)
      
                                                                     ,array("type"=>"select"
                                                                            ,"field"=>"focus_esp_rend"
                                                                            ,"label"=>"Focus"
                                                                            ,'columns' => 2
                                                                            ,'choices' =>$focus)
                                                                  )
      
                                                  )
      
                                              ,array("type"=>"group"
                                                   ,"field"=>"general_rend"
                                                   ,"label"=>"Obj General"
                                                   ,"add_more"=>true
                                                   ,'columns' => 10
                                                   ,'fields' =>array(
                                                                      array( "type"=>"select"
                                                                            ,"field"=>"general_rend_obj"
                                                                            ,"label"=>"Objetivo"
                                                                            ,'columns' => 10
                                                                            ,'choices' =>$obj_gral_rend
                                                                           )
                                                                     ,array("type"=>"select"
                                                                            ,"field"=>"focus_gral_rend"
                                                                            ,"label"=>"Focus"
                                                                            ,'columns' => 2
                                                                            ,'choices' =>$focus)
                                                                     )
                                                      )
                                      )
                                 
                      )
                  )
          ));

      It’s look complex but that is my data model.

      Thanks

    • #7305
      Steve
      Keymaster

      Do you really need groups within groups? It forces the fields to save a multidimensional array.

    • #7311
      tronseba
      Participant

      The information I need to store it as complex as you can see, i know that is a multidimentional array, late I will consume it with a rest service and parse it into a movile app.

      Anyway I found a workarrount ussing conditional fields.

      Thanks.

    • #7316
      Steve
      Keymaster

      Great! Closing ticket.

Viewing 3 reply threads
  • The topic ‘[0.9.9.9] Add more problem’ is closed to new replies.