Hello
How to get RelationItem information into NGclient Java script?
example:
Source and Destination, From and To information based on Relation name? as show in attached image.
Example code into NGClient Java script like
var test = $scope.model.foundset.foundset.article_stock_to_article;
Thank you
/**
* @properties={typeid:24,uuid:"E9D82B51-C9DA-41B7-91FD-292C149DBEED"}
*/
function getRelationItems()
{
var relation = solutionModel.getRelation('article_to_article_stock')
var array_relation_items = relation.getRelationItems()
/** @type {JSRelationItem} */
var item
application.output('primary datasource : ' + relation.primaryDataSource)
application.output('foreign datasource : ' + relation.foreignDataSource)
for(var i = 0 ; i < array_relation_items.length ; i++)
{
// this outputs a relation item object
item = array_relation_items[i]
application.output('relation item no. ' + i);
application.output('primary column: ' + item.primaryDataProviderID);
application.output('operator: ' + item.operator);
application.output('foreign column: ' + item.foreignColumnName);
}
}
you mean you want to have those relation names inside the component/client side javascript?
NGClient does do that, we don’t leak the datamodel to the client, for this we have foundset property that defines its own dataprovider mapping and so on
Maybe you can look at the dbtreeview: https://github.com/Servoy/servoy-extra- … dbtreeview and how that component does this walking over relations.