Relations Information in NGclient

Forum to discuss the new web client version of Servoy.

Relations Information in NGclient

Postby binkal.patel » Tue Jun 13, 2017 8:18 am

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
You do not have the required permissions to view the files attached to this post.
binkal.patel
 
Posts: 5
Joined: Mon Jun 12, 2017 3:59 pm

Re: Relations Information in NGclient

Postby robrecht » Tue Jun 13, 2017 12:42 pm

Code: Select all
/**
* @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);
   }
}
robrecht
 
Posts: 99
Joined: Wed Aug 01, 2012 4:30 pm

Re: Relations Information in NGclient

Postby jcompagner » Tue Jun 20, 2017 11:45 am

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.
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8833
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet


Return to Servoy NGClient

Who is online

Users browsing this forum: No registered users and 12 guests