Find Root data source in axapta
str dataSourcesPath = '\\Web\\Web Forms\\' + _webFormName + '\\Data Sources\\';
str currentDataSourcePath = dataSourcesPath + dataSourceName;
TreeNode currentDataSourceNode = infolog.findNode(currentDataSourcePath);
str parent = currentDataSourceNode.AOTgetProperty('JoinSource');
str linkType = currentDataSourceNode.AOTgetProperty('LinkType');
// No parent or not an inner or active join
if (parent == '' || (linkType != 'InnerJoin' && linkType != 'OuterJoin'))
{
return dataSourceName;
}