The filter have already an effect in one corner case, when you edit such AttributeLinkedSet(Indirect) as a "property" and not as a tab. The filter is used for edition.
If your purpose is to have a filter in display, you must use AttributeDashboard to display a filtered relationship.
If your purpose is to filter in edition as a tab get a look at PrefillSearchForm() as well as the ExternalKey filter tag for AttributeLinkedSetIndirect
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thank's for your answer.
For the context i'm trying to add a tab in view mod on the Location Class.
the AttributeLinkedSet work great but i can't filter the result on a specific field.
The DisplayBareRelations seem to not work on Location Class, maybe i'm doing something wrong, but when i try the same method on a custom class it's working well and add the Tab.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
So i should use AttributeLinkedSetIndirect instead of AttributeLinkedSet ?
In this following code, the filter is not working
<fields>
<field id="toto_list" xsi:type="AttributeLinkedSet" _delta="define">
<linked_class>TOTO</linked_class>
<filter><![CDATA[SELECT TOTO AS D WHERE D.tv='yes']]></filter>
<ext_key_to_me>location_id</ext_key_to_me>
<edit_mode>add_only</edit_mode>
<count_min>0</count_min>
<count_max>0</count_max>
</field>
</fields>
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
DisplayBareRelations works on all class, but it's much more work than adding a simple AttributeDasboard which would display what ever filtered lists and dashlets related to the current object, you want.
👍
1
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
Are filters on AttributeLinkedSet fields planned for the future?
Or do you have an alternative to display a filtered list ?
Thank you
Regards
The filter have already an effect in one corner case, when you edit such AttributeLinkedSet(Indirect) as a "property" and not as a tab. The filter is used for edition.
If your purpose is to have a filter in display, you must use AttributeDashboard to display a filtered relationship.
If your purpose is to filter in edition as a tab get a look at PrefillSearchForm() as well as the ExternalKey filter tag for AttributeLinkedSetIndirect
Thank's for your answer.
For the context i'm trying to add a tab in view mod on the Location Class.
the AttributeLinkedSet work great but i can't filter the result on a specific field.
The DisplayBareRelations seem to not work on Location Class, maybe i'm doing something wrong, but when i try the same method on a custom class it's working well and add the Tab.
So i should use AttributeLinkedSetIndirect instead of AttributeLinkedSet ?
In this following code, the filter is not working
<fields>
<field id="toto_list" xsi:type="AttributeLinkedSet" _delta="define">
<linked_class>TOTO</linked_class>
<filter><![CDATA[SELECT TOTO AS D WHERE D.tv='yes']]></filter>
<ext_key_to_me>location_id</ext_key_to_me>
<edit_mode>add_only</edit_mode>
<count_min>0</count_min>
<count_max>0</count_max>
</field>
</fields>
I've also try to do a method to display a tab filter like i want but the tab is not showing on the Location, the same method is working on other Class :
<methods>
<method id="DisplayBareRelations" _delta="define">
<static>false</static>
<access>public</access>
<type>Overload-cmdbAbstractObject</type>
<![CDATA
function DisplayBareRelations(WebPage $oPage, $bEditMode = false)
{
parent::DisplayBareRelations($oPage, $bEditMode);
if ((!$bEditMode) && (MetaModel::IsValidClass('TOTO')))
{
//Afficheurs
$myID = $this->GetKey();
$oIfFilter = DBObjectSearch::FromOQL("SELECT TOTO AS D WHERE D.tv='yes' AND D.location_id = {$myID}");
$oIfSet = new CMDBObjectSet($oIfFilter);
$iNumber = $oIfSet->count();
$sTabName = $oPage->FindTab('/^' . Dict::S('Class:Location/Attribute:list2') . '/');
if ($iNumber > 0)
{ // here we use the standard iTop way to display tab with data inside
$oPage->SetCurrentTab(Dict::S('Class:Location/Attribute:list2') . " ({$iNumber})");
} else { // or without data inside with no brackets and no count
$oPage->SetCurrentTab(Dict::S('Class:Location/Attribute:list2'));
}
$oBlock = new DisplayBlock($oIfSet->GetFilter(), 'list', false);
$aExtraParam = array('menu' => true, 'display_limit' => false);
$oBlock->Display($oPage, Dict::S('Class:Location/Attribute:list2'), $aExtraParam);
}
}
]>
</method>
</methods>
DisplayBareRelations works on all class, but it's much more work than adding a simple AttributeDasboard which would display what ever filtered lists and dashlets related to the current object, you want.
Great thank you, it's works with a Dashboard