This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$query = new SugarQuery(); | |
$query->from(BeanFactory::getBean('Accounts')); | |
$query->join('contacts', array('alias' => 'industryContacts')); | |
$query->join('opportunities', array('relatedJoin' => 'industryContacts', 'alias' => 'contactsOpportunities')); | |
$query->select()->setCountQuery(); | |
$query->where()->equals('contactsOpportunities.sales_stage', 'closed'); | |
$havingCondition = new SugarQuery_Builder_Condition($query); | |
$havingCondition->setField('contactsOpportunities.amount')->setOperator('>')->setValues('1000'); | |
$query->having($havingCondition); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$query = new SugarQuery(); | |
$query->from(BeanFactory::getBean('Accounts')); | |
$query->join('contacts', array('alias' => 'industryContacts')); | |
$query->join('opportunities', array('relatedJoin' => 'industryContacts', 'alias' => 'contactsOpportunities')); | |
$query->select()->setCountQuery(); | |
$query->where()->equals('contactsOpportunities.sales_stage', 'closed'); | |
$query->groupBy('accounts.industry'); | |
$results = $query->execute(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$query = new SugarQuery(); | |
$query->from(BeanFactory::getBean('Accounts')); | |
$query->join('contacts', array('alias' => 'industryContacts')); | |
$query->join('opportunities', array('relatedJoin' => 'industryContacts', 'alias' => 'contactsOpportunities')); | |
$query->select(array(array('industryContacts.first_name', 'fname'), array('industryContacts.last_name', 'lname'), 'contactsOpportunities.name')); | |
$query->where()->equals('industryAccounts.industry','Media'); | |
$query->where()->equals('contactsOpportunities.sales_stage', 'closed'); | |
$query->orderBy('industryContacts.name', 'DESC'); | |
$results = $query->execute(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$query = new SugarQuery(); | |
$query->from(BeanFactory::getBean('Accounts')); | |
$query->join('contacts', array('alias' => 'industryContacts')); | |
$query->join('opportunities', array('relatedJoin' => 'industryContacts', 'alias' => 'contactsOpportunities')); | |
$query->select(array(array('industryAccounts.first_name', 'fname'), array('industryContacts.last_name', 'lname'), 'contactsOpportunities.name')); | |
$query->where()->equals('industryAccounts.industry','Media'); | |
$query->where()->equals('contactsOpportunities.sales_stage', 'closed'); | |
$results = $query->execute(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$query = new SugarQuery(); | |
$query->from(BeanFactory::getBean('Accounts')); | |
$contacts = $query->join('contacts')->joinName(); | |
$opp = $query->join('opportunities', array('relatedJoin' => $contacts))->joinName(); | |
$query->select(array("$contacts.full_name", "$opp.name")); | |
$query->where()->equals('industry','media'); | |
$query->where()->equals("$opp.sales_stage", 'closed'); | |
$results = $query->execute(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$query = new SugarQuery(); | |
$query->from(BeanFactory::getBean('Accounts')); | |
$contacts = $query->join('contacts')->joinName(); | |
$query->select(array("$contacts.full_name")); | |
$query->where()->equals('industry','Media'); | |
$results = $query->execute(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$query = new SugarQuery(); | |
$query->select(array('id','name')); | |
$query->from(BeanFactory::getBean('Accounts')); | |
$query->where()->equals('industry','Media'); | |
$results = $query->execute(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INDEXES: | |
{"Accounts":{"properties":{"name":{"boost":3,"type":"string"},"phone_fax":{"boost":1,"type":"string"},"phone_office":{"boost":1,"type":"string"},"phone_alternate":{"boost":1,"type":"string"},"email1":{"boost":3,"index":"not_analyzed","type":"string"},"doc_owner":{"boost":1,"type":"string","index":"not_analyzed"},"user_favorites":{"boost":1,"type":"array","index":"not_analyzed"}}}} | |
{"Calls":{"properties":{"name":{"boost":"1","type":"string"},"description":{"boost":"3","type":"string"},"doc_owner":{"boost":1,"type":"string","index":"not_analyzed"},"user_favorites":{"boost":1,"type":"array","index":"not_analyzed"}}}} | |
{"Cases":{"properties":{"name":{"boost":3,"type":"string"},"case_number":{"boost":3,"type":"string"},"doc_owner":{"boost":1,"type":"string","index":"not_analyzed"},"user_favorites":{"boost":1,"type":"array","index":"not_analyzed"}}}} | |
RECORDS: | |
{ | |
_index: 5b04e75a7a93007a0bbdbb4a4764804f |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$properties['doc_owner'] = array( | |
'boost' => 1, | |
'type' => 'string', | |
'index' => 'not_analyzed' | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"Meetings":{"properties":{"name":{"type":"string"},"date_start":{"type":"date","index":"not_analyzed"},"date_end":{"type":"date","index":"not_analyzed"},"doc_owner":{"boost":1,"type":"string","index":"not_analyzed"}}}} | |
{"index":{"_index":"40f6c8db6e0db0a0665860ce8a683fc4","_type":"Meetings","_id":"827cf1c8-c4c4-ebe2-b285-503fa0a76a21"}} | |
{"name":"Review needs","date_start":"2013-02-18T12:00:00+0100","date_end":"2013-02-18T13:00:00+0100","module":"Meetings","team_set_id":"West","doc_owner":"seed_max_id"} | |
{"index":{"_index":"40f6c8db6e0db0a0665860ce8a683fc4","_type":"Meetings","_id":"93b48de6-5a3d-5dee-c2f8-503fa02576e5"}} | |
{"name":"Discuss pricing","date_start":"2013-02-21T10:00:00+0100","date_end":"2013-02-21T11:45:00+0100","module":"Meetings","team_set_id":"East","doc_owner":"seed_chris_id"} | |
{"index":{"_index":"40f6c8db6e0db0a0665860ce8a683fc4","_type":"Meetings","_id":"9ed7fec4-1196-ea64-78fb-503fa0cb7606"}} | |
{"name":"Discuss pricing","date_start":"2013-02-21T13:15:00+0100","date_end":"2013-02-21T16:00:00+01 |
NewerOlder