Results 1 to 2 of 2

Thread: [HELP]definition type=relate Vardefs.php

  1. #1
    somaggio is offline Junior Member
    Join Date
    Aug 2006
    Posts
    3

    Default [HELP]definition type=relate Vardefs.php

    I'am trying to define the type=relate in vardefs.php

    In my custom module 'PDL', I have an field account_id that containe the id of client.
    and I want to show the name of client related on this id.
    So I defined vardefs.php in below. but in my webpage, it doesn't it show...
    I must add an query for showing the account_name in my private function fill_in_additional_detail_fields().

    I have seen many questions related on this.
    I tried but I didn't success.....

    'account_id' => array (
    'name' => 'account_id',
    'reportable'=>false,
    'dbtype' => 'id',
    'required'=>false,
    ),

    'account_name' => array (
    'name' => 'account_name',
    'type'=>'relate',
    'id_name' => 'account_id',
    'source' => non-db',
    'table'=>'account'
    ),


    thanks.

  2. #2
    ruchida's Avatar
    ruchida is offline A Sugar Hero | Help Forum Moderator
    Join Date
    Feb 2005
    Location
    Japan
    Posts
    1,375

    Default Re: [HELP]definition type=relate Vardefs.php

    Quote Originally Posted by somaggio
    'account_id' => array (
    'name' => 'account_id',
    'reportable'=>false,
    'dbtype' => 'id',
    'required'=>false,
    ),

    'account_name' => array (
    'name' => 'account_name',
    'type'=>'relate',
    'id_name' => 'account_id',
    'source' => non-db',
    'table'=>'account'
    ),
    thanks.
    Hi,
    If you're translating your account_id into account_name by looking into the accounts table, you may need to define as below. The 'rname' is the field name of the accounts table where an account name is stored. The 'table' name needs to be correct like 'accounts' (plural).
    PHP Code:
        'account_name' =>
            array (
                
    'name' => 'account_name',
                
    'rname' => 'name',
                
    'id_name' => 'account_id',
                
    'vname' => 'LBL_ACCOUNT_NAME',
                
    'type' => 'relate',
                
    'table' => 'accounts',
                
    'isnull' => 'true',
                
    'module' => 'Accounts',
                
    'dbType' => 'varchar',
                
    'len' => '255',
                
    'source' => 'non-db',
            ), 
    Ryuhei Uchida
    Help Forum Moderator
    Calendar 2.0
    http://blogs.itmedia.co.jp/ruchida/

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •