And I'm trying to display list of all tickets (i.e. UserRequest, Incident, Change, and Problem) that are assigned to a contact person AND is_active_ticket is 'yes'. However, the filter does NOT seem to work in the "AttributeLinkedSet" field and just display all tickets that are assigned to the person (I have tested the OQL in "Run Queries" and the query filter works in the "Run Queries"). Please find below the sample code
Is there something wrong with my code? Or is there any bug/limitation regarding "AttributeLinkedSet" with <filter> (https://sourceforge.net/p/itop/tickets/1760/ AND https://sourceforge.net/p/itop/discussion/922360/thread/cf6026f8/ ) in iTop 2.4.0? Is there any workaround?</filter>
NOTE on workaround:
1. It seems that for FunctionalCI class there's active tickets field and it will only display tickets that are NOT in "closed" state. But I can't seem to find the code to do this there's only this in datamodels/2.x/itop-config-mgmt Class:FunctionalCI/Tab:OpenedTickets in the datamodel and Class:FunctionalCI/Tab:OpenedTickets' => 'Active Tickets. $oPage->SetCurrentTab(Dict::S('Class:FunctionalCI/Tab:OpenedTickets').$sCount);
Possibly a workaround is to apply filter to datatables in client-side since iTop table uses datatables but I haven't tried this
That filter was planned to be coded one day and it is still not coded as it's mentioned in recent version of the documentation: Not used by iTop for now! OQL query to define objects to which the current object can be linked. It's the counterpart of the //filter// on the corresponding ExternalKey.
I have no solution for you with iTop version 2.4. The best response to your need is the AttributeDashboard brought by version 2.6, and if you upgrade, take the 2.7 at least it will be maintained with security fix for at least 2 more years from now.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Managed to get this to work on iTop 2.4.0 by reverse engineering the code in itop-config-mgmt/datamodel.itop-config-mgmt.xmlFunctionalCI class Tab:OpenedTickets.
For those who are interested, please find below the code snippet datamodel.xml
<?xmlversion="1.0"encoding="UTF-8"?><itop_designxmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"version="1.0"><constants></constants><classes><classid="Person"><methods><methodid="DisplayBareRelations"_delta="define"><static>false</static><access>public</access><type>Overload-cmdbAbstractObject</type><code><![CDATA[functionDisplayBareRelations(WebPage$oPage,$bEditMode=false){//TODO:UpdatetheWHEREconditionasrequiredwheniteratingthroughTicketsubclasses(i.e.UserRequest,Incident,Change,Problem)in$oSearch$queryWhereCondition="t.agent_id = :myself AND t.is_active_ticket = 'yes' AND t.operational_status = 'ongoing'";parent::DisplayBareRelations($oPage,$bEditMode);$sTicketListAttCode='tickets_list';if(MetaModel::IsValidAttCode(get_class($this),$sTicketListAttCode)){//Displayonelistperleafclass(theonlywaytodisplaythestatusasofnow)//i.e.UserRequest,Incident,Change,andProblem$iTotal=0;$aSearches=array();foreach(MetaModel::EnumChildClasses('Ticket')as$sSubClass){if(!MetaModel::HasChildrenClasses($sSubClass)){$sStateAttCode=MetaModel::GetStateAttributeCode($sSubClass);if($sStateAttCode!=''){$oSearch=DBSearch::FromOQL("SELECT $sSubClass AS t WHERE $queryWhereCondition",array('myself'=>$this->GetKey()));$aSearches[$sSubClass]=$oSearch;$oSet=newDBObjectSet($oSearch);$iTotal+=$oSet->Count();}}}$sCount=($iTotal>0)?' ('.$iTotal.')':'';$oPage->SetCurrentTab(Dict::S('Class:Person/Tab:OpenedTickets').$sCount);foreach($aSearchesas$sSubClass=>$oSearch){$sBlockId=__class__.'_opened_'.$sSubClass;$oPage->add('<fieldset>');$oPage->add('<legend>'.MetaModel::GetName($sSubClass).'</legend>');$oBlock=newDisplayBlock($oSearch,'list',false);$oBlock->Display($oPage,$sBlockId,array('menu'=>false));$oPage->add('</fieldset>');}}}]]></code></method></methods></class></classes><menus></menus><user_rights><groups></groups><profiles></profiles></user_rights></itop_design>
dictionary.xml
<?phpDict::Add('EN US','English','English',array(// Dictionary entries go here'Class:Person/Tab:OpenedTickets'=>'Active Tickets',));?>
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi All,
I hope all of you are well.
I'm using iTop 2.4.0 and I'm trying to apply a filter to a "AttributeLinkedSet" field.
I have created the below field in
Ticket
classAnd I'm trying to display list of all tickets (i.e. UserRequest, Incident, Change, and Problem) that are assigned to a contact person AND
is_active_ticket
is 'yes'. However, the filter does NOT seem to work in the "AttributeLinkedSet" field and just display all tickets that are assigned to the person (I have tested the OQL in "Run Queries" and the query filter works in the "Run Queries"). Please find below the sample codeIs there something wrong with my code? Or is there any bug/limitation regarding "AttributeLinkedSet" with <filter> (https://sourceforge.net/p/itop/tickets/1760/ AND https://sourceforge.net/p/itop/discussion/922360/thread/cf6026f8/ ) in iTop 2.4.0? Is there any workaround?</filter>
NOTE on workaround:
1. It seems that for
FunctionalCI
class there's active tickets field and it will only display tickets that are NOT in "closed" state. But I can't seem to find the code to do this there's only this in datamodels/2.x/itop-config-mgmtClass:FunctionalCI/Tab:OpenedTickets
in the datamodel andClass:FunctionalCI/Tab:OpenedTickets' => 'Active Tickets
.$oPage->SetCurrentTab(Dict::S('Class:FunctionalCI/Tab:OpenedTickets').$sCount);
Possibly a workaround is to apply filter to datatables in client-side since iTop table uses datatables but I haven't tried this
Thank you and I look forward to hearing from you.
That filter was planned to be coded one day and it is still not coded as it's mentioned in recent version of the documentation:
Not used by iTop for now! OQL query to define objects to which the current object can be linked. It's the counterpart of the //filter// on the corresponding ExternalKey.
I have no solution for you with iTop version 2.4. The best response to your need is the AttributeDashboard brought by version 2.6, and if you upgrade, take the 2.7 at least it will be maintained with security fix for at least 2 more years from now.
Hi Vincent,
Thank you very much for the recommendation.
Managed to get this to work on iTop 2.4.0 by reverse engineering the code in
itop-config-mgmt/datamodel.itop-config-mgmt.xml
FunctionalCI
classTab:OpenedTickets
.For those who are interested, please find below the code snippet
datamodel.xml
dictionary.xml