Document Relations

From version v1.2, it is possible to build a query that will filter results according to the document relation or to request information about related documents.

There are 2 ways to create relations between documents in the fCMSPro:


For example, if we need to retrieve 'news' documents 'tagged_with' 'asia>china', we can do the following:
Code:
fTemplate.query = fMaster.getQuery();
fTemplate.query.addFilter( "$DOCTYPE", "=", "news" );
var myTagID:Number = fMaster.getTagIDByLabel( [ "asia", "china" ] );
fTemplate.query.taggedWith( myTagID );

and the output will be:
Code:
/------------------------------------
| select *
| from 0 to 5
| sort on $CREATIONTIME(date_time) DESC
| where $LANG = deflang (string)
| AND $DOCTYPE = news (string)
| -> tagged_with [ myTagID ]

In many cases, you will want to execute a Query using the fMaster.invoke method. For example, if you want to display the results of a search query in the fIndex component while the fIndex is not present on the timeline because a user has clicked on a search button, you can cache your query until the fIndex appears on the timeline. In this case you can execute the invoke method when the search button is clicked.

 

Please refer to the ActionScript reference section on the Query object for more details.