static void AXCopyUsergroupRLSBytableWithVlaue(Args _args)
{
SysRecordLevelSecurity SysRecordLevelSecurity,insertRLS,copyvalue,updatevalues;
dialogfield srcdf,destdf;
dialog dialog;
userGroupid dest;
sysQueryRun queryRun;
Query query = new Query() ;
QueryRun rlsqueryRun;
int dataSourceNo;
queryBuildDataSource queryBuildDataSource;
queryBuildRange queryBuildRange;
int i;
;
dialog = new dialog("copying user group's Record Level security ");
destdf = dialog.addField(typeid(userGroupid),"Destination");
if(dialog.run())
{
dest = destdf.value();
if( dest !="")
{
ttsbegin;
//insert new table in RLS table to destination user group;
insertRLS.tabId = 18174;
insertRLS.groupId = dest;
insertRLS.companyId = curext();
insertRLS.insert();
//fetch same query values from another table;
select * from copyvalue
where copyvalue.groupId == dest
&& copyvalue.tabId == 624;//example project table
rlsqueryRun = new QueryRun(copyvalue.Restriction);
dataSourceNo = rlsqueryRun .query().dataSourceCount();
queryBuildDataSource = rlsqueryRun .query().dataSourceNo(dataSourceNo);
for(i = 1;i <= queryBuildDataSource.rangeCount();i++)
{
queryBuildRange = queryBuildDataSource.range(i);
}
select forupdate updatevalues where updatevalues.groupId == dest
&& updatevalues.tabId == 18174;
if (updatevalues.Restriction)
{
queryRun = new SysQueryRun(updatevalues.Restriction);
}
else
{
query.addDataSource(updatevalues.TabId);
queryRun = new SysQueryRun(query);
}
queryRun.query().dataSourceTable(updatevalues.tabId).addRange(fieldnum(PAYFDocumentMoveTracking,PROJID)).value(queryBuildRange.value());
updatevalues.restriction = queryRun.pack();
updatevalues.doUpdate();
ttscommit;
info("User groups RLS has been copied!");
}
}
else
{
info("Canceled by user");
}
}
{
SysRecordLevelSecurity SysRecordLevelSecurity,insertRLS,copyvalue,updatevalues;
dialogfield srcdf,destdf;
dialog dialog;
userGroupid dest;
sysQueryRun queryRun;
Query query = new Query() ;
QueryRun rlsqueryRun;
int dataSourceNo;
queryBuildDataSource queryBuildDataSource;
queryBuildRange queryBuildRange;
int i;
;
dialog = new dialog("copying user group's Record Level security ");
destdf = dialog.addField(typeid(userGroupid),"Destination");
if(dialog.run())
{
dest = destdf.value();
if( dest !="")
{
ttsbegin;
//insert new table in RLS table to destination user group;
insertRLS.tabId = 18174;
insertRLS.groupId = dest;
insertRLS.companyId = curext();
insertRLS.insert();
//fetch same query values from another table;
select * from copyvalue
where copyvalue.groupId == dest
&& copyvalue.tabId == 624;//example project table
rlsqueryRun = new QueryRun(copyvalue.Restriction);
dataSourceNo = rlsqueryRun .query().dataSourceCount();
queryBuildDataSource = rlsqueryRun .query().dataSourceNo(dataSourceNo);
for(i = 1;i <= queryBuildDataSource.rangeCount();i++)
{
queryBuildRange = queryBuildDataSource.range(i);
}
select forupdate updatevalues where updatevalues.groupId == dest
&& updatevalues.tabId == 18174;
if (updatevalues.Restriction)
{
queryRun = new SysQueryRun(updatevalues.Restriction);
}
else
{
query.addDataSource(updatevalues.TabId);
queryRun = new SysQueryRun(query);
}
queryRun.query().dataSourceTable(updatevalues.tabId).addRange(fieldnum(PAYFDocumentMoveTracking,PROJID)).value(queryBuildRange.value());
updatevalues.restriction = queryRun.pack();
updatevalues.doUpdate();
ttscommit;
info("User groups RLS has been copied!");
}
}
else
{
info("Canceled by user");
}
}