if i want to fetch particular column value..
like from person table I would like to fetch mobile_phone column value of particular person.
how can i do this??..
Please help me or guide me...
Thanks in advance...
Regards
Pankaj
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
iTop is based on what we call an ORM (Object Relational Mapper) layer. This means that, inside iTop, we always handle complete PHP objects and not database columns.
Imagine that you want to print the name of all persons whose name contains 'e':
$sOQL="SELECT Person WHERE name LIKE '%e%'";$oSet=newDBObjectSet(DBObjectSearch::FromOQL($sOQL));while($oPerson=$oSet->Fetch()){echo$oPerson->Get('name').'';}
Now if you want to retrieve only the 'name' attribute of the Person, you can speed-up the query by limiting the columns loaded by the ORM. The code would look like:
$sOQL="SELECT Person WHERE name LIKE '%e%'";$oSet=newDBObjectSet(DBObjectSearch::FromOQL($sOQL));$oSet->OptimizeColumnLoad(array('name'));while($oPerson=$oSet->Fetch()){echo$oPerson->Get('name').'';}
Hope this helps,
Denis
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
$sOQL = "SELECT Service WHERE name LIKE '%S%'";
$oSet = new DBObjectSet(DBObjectSearch::FromOQL($sOQL));
$oSet->OptimizeColumnLoad(array('name'));
while($oPerson = $oSet->Fetch())
{
$name= $oPerson->Get('name').'...\n ';
}
Error: Unknown filter code, found 'name' in: SELECT Service WHERE name LIKE '%S%'.
Notice: Undefined index: friendlyname in C:\wamp\www\web3.1.0\core\metamodel.class.php on line 830
Fatal error: Call to a member function LoadInObject() on a non-object in C:\wamp\www\web3.1.0\core\dbobject.class.php on line 420
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
$sOQL = "SELECT Service WHERE name LIKE \'%A%\'";
$oSet = new DBObjectSet(DBObjectSearch::FromOQL($sOQL));
$oSet->OptimizeColumnLoad(array('name'));
while($oPerson = $oSet->Fetch())
{
$aa= $oPerson->Get('name').' ';
// print_r($aa);
}
Error: Unexpected input at line 1: .
Notice: Undefined index: friendlyname in C:\wamp\www\web3.1.0\core\metamodel.class.php on line 830
Fatal error: Call to a member function LoadInObject() on a non-object in C:\wamp\www\web3.1.0\core\dbobject.class.php on line 420
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Error: Wrong value for field name in ORDER BY spec, found 'friendlyname' while expecting a value in {name, org_id, organization_name, servicefamily_id, servicefamily_name, description, documents_list, contacts_list, status, customercontracts_list, providercontracts_list, functionalcis_list, servicesubcategories_list, coverage_window_id, holiday_id, auto_assignement}.
Notice: Undefined index: friendlyname in C:\wamp\www\web3.1.0\core\metamodel.class.php on line 830
Fatal error: Call to a member function LoadInObject() on a non-object in C:\wamp\www\web3.1.0\core\dbobject.class.php on line 420
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
Again need a help to solve a problem.
if i want to fetch particular column value..
like from person table I would like to fetch mobile_phone column value of particular person.
how can i do this??..
Please help me or guide me...
Thanks in advance...
Regards
Pankaj
Hi Pankaj,
iTop is based on what we call an ORM (Object Relational Mapper) layer. This means that, inside iTop, we always handle complete PHP objects and not database columns.
Imagine that you want to print the name of all persons whose name contains 'e':
Now if you want to retrieve only the 'name' attribute of the Person, you can speed-up the query by limiting the columns loaded by the ORM. The code would look like:
Hope this helps,
Denis
Sorry sir bit gives error...
$sOQL = "SELECT Service WHERE name LIKE '%S%'";
$oSet = new DBObjectSet(DBObjectSearch::FromOQL($sOQL));
$oSet->OptimizeColumnLoad(array('name'));
while($oPerson = $oSet->Fetch())
{
$name= $oPerson->Get('name').'...\n ';
}
Error: Unknown filter code, found 'name' in: SELECT Service WHERE name LIKE '%S%'.
Notice: Undefined index: friendlyname in C:\wamp\www\web3.1.0\core\metamodel.class.php on line 830
Fatal error: Call to a member function LoadInObject() on a non-object in C:\wamp\www\web3.1.0\core\dbobject.class.php on line 420
Now its gives error....
$sOQL = "SELECT Service WHERE name LIKE \'%A%\'";
$oSet = new DBObjectSet(DBObjectSearch::FromOQL($sOQL));
$oSet->OptimizeColumnLoad(array('name'));
while($oPerson = $oSet->Fetch())
{
$aa= $oPerson->Get('name').' ';
// print_r($aa);
}
Error: Unexpected input at line 1: .
Notice: Undefined index: friendlyname in C:\wamp\www\web3.1.0\core\metamodel.class.php on line 830
Fatal error: Call to a member function LoadInObject() on a non-object in C:\wamp\www\web3.1.0\core\dbobject.class.php on line 420
Hello Denis sir,
May i know that i am missing some thing,this query is not running ...gives error...
....
Error: Wrong value for field name in ORDER BY spec, found 'friendlyname' while expecting a value in {name, org_id, organization_name, servicefamily_id, servicefamily_name, description, documents_list, contacts_list, status, customercontracts_list, providercontracts_list, functionalcis_list, servicesubcategories_list, coverage_window_id, holiday_id, auto_assignement}.
Notice: Undefined index: friendlyname in C:\wamp\www\web3.1.0\core\metamodel.class.php on line 830
Fatal error: Call to a member function LoadInObject() on a non-object in C:\wamp\www\web3.1.0\core\dbobject.class.php on line 420
Hello Denis sir,
why this error comes when i run query...this query works fine when..i tested in RUN OQL...
Please quide me....