I was able to figure this out & this is how i did it:

<table>
    <th>Owner</th>
    <th>Gender</th>
    <th>ID Number</th>
    <th>Relationship</th>
    <th>Policy</th>
    <th>Category 1</th>
    <th>Category 1 Premium</th>
    <th>Category 1 Benefits</th>
    <th>Category 2</th>
    <th>Category 2 Premium</th>
    <th>Category 2 Benefits</th>
    
            {{for nu in nuclear:}}

    <tr>
        <td>{{=client_name(nu.client)}}</td>
        <td>{{=nu.client.gender}}</td>
        <td>{{=nu.client.id_number}}</td>
        <td>{{=nu.client.relationship}}</td>
        <td>{{=nu.policy_1}}</td>
        
        <td>{{=nu.member_only.package_name}}</td>
        <td>{{=nu.member_only.montly_subscription}}</td>
        <td>{{=nu.member_only.take_away_package}}</td>
    
        <td>{{=nu.member_and_newclear_family.package_name}}</td>
        <td>{{=nu.member_and_newclear_family.montly_subscription}}</td>
        <td>{{=nu.member_and_newclear_family.take_away_package}}</td>
        <td></td>
        </tr>

    <tr>
        <td>{{=client_name(nu.client)}}</td>
        <td>{{=nu.spouse_full_name}}</td>
        <td>{{=nu.relationship}}</td>
        <td>{{=nu.id_number}}</td>
    </tr>
    <tr>
            {{for ch in children:}}
{{if ch.client.id==nu.client.id:}}
        <td>{{=client_name(ch.client)}}</td>
        <td>{{=ch.childs_full_names}}</td>
        <td>{{=ch.relationship}}</td>
        <td>{{=ch.policyCover.package_name}}</td>
        <td>{{=ch.policy_benefit}}</td>
        {{pass}}
    </tr>
    {{pass}}
    <tr>
            {{for pr in parent:}}
        {{if pr.client.id==nu.client.id:}}
        <td>{{=client_name(pr.client)}}</td>
        <td>{{=pr.full_name}}</td>
        <td>{{=pr.relationship}}</td>
        <td>{{=pr.policy_1}}</td>
        <td>{{=pr.parent_policy.package_name}}</td>
        
<td></td><td></td><td></td><td></td><td>{{=pr.parent_policy.montly_subscription}}</td>
        {{pass}}
    </tr>
    {{pass}}
    <tr>
            {{for ex in extended:}}
        {{if ex.client.id==nu.client.id:}}
        <td>{{=client_name(ex.client)}}</td>
        <td>{{=ex.full_names}}</td>
        <td>{{=ex.relationship}}</td>
        <td>{{=ex.policy_1}}</td>
        <td>{{=ex.extended_family.package_name}}</td>
        
<td></td><td></td><td></td><td></td><td>{{=ex.extended_family.montly_subscription}}</td>
        {{pass}}
    </tr>
    {{pass}}
    {{pass}}
</table>

currently so far so good
On Saturday, April 9, 2022 at 9:13:03 PM UTC+2 mostwanted wrote:

> Guys i need help here, I have an insurance database that has 3 tables of 
> information that relates to the client (account holder), what i want to do 
> is to be able to group each piece of information according to its owner 
> (account holder) in an html table in the view and not have it mixed up. 
> Have client A details in row 1, client A children details in row 2 and 
> client A parents information in the following row. From there client B and 
> his information in the subsequent rows then client C & so on. How can i 
> achieve this??
>
> *MODELS*
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> *db.define_table('client',                Field('gender', 
> requires=IS_IN_SET(['Mr', 'Mrs', 'Miss'], zero='---Select Gender---')),    
>             Field('last_name', requires=IS_NOT_EMPTY()),                
> Field('first_name', requires=IS_NOT_EMPTY()),                
> Field('id_number', requires = IS_MATCH('^\d{9}?$', error_message='An ID 
> Number should have exactly 9 digits')))db.define_table('children',          
>       Field('client', 'reference client', writable=False),                
> Field('gender', requires=IS_IN_SET(['Male', 'Female', 'None'], 
> zero='---Select Gender---')),                Field('childs_full_names', 
> requires=IS_NOT_EMPTY()),                Field('dob', 'date', 
> requires=IS_NOT_EMPTY()),              
>  )db.define_table('parents_and_in_laws',                Field('client', 
> 'reference client', writable=False),                Field('gender', 
> requires=IS_IN_SET(['Mr', 'Mrs', 'Miss', 'None'], zero='---Select 
> Gender---')),                Field('full_name', requires=IS_NOT_EMPTY()),  
>               Field('id_number', requires = IS_MATCH('^\d{9}?$', 
> error_message='An ID Number should have exactly 9 digits')),                
> Field('relationship', requires=IS_NOT_EMPTY()))*
>
> *Controller:*
>
>
>
>
>
> *def client_policy_packages():    
> nuclear=db(db.newclear_family.).select(db.newclear_family.ALL)    
> children=db(db.children).select(db.children.ALL)    
> parent=db(db.parents_and_in_laws).select(db.parents_and_in_laws.ALL)    
> extended=db(db.extended_family).select(db.extended_family.ALL)    return 
> locals()*
>
> *View:*
>
> *------------------------*
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/d0c48240-b7ed-4f8d-8a04-e57d674b179an%40googlegroups.com.

Reply via email to