
This simple runbase class is a ready-to-use tool to perform a Database synchronization for a single table
Through X++ code we can perform database synchronization either on a required table (or) on all tables bases on our requirement.
This could be very useful during on-premises environments package deployments because can can drastically reduce the downtime.
In fact you can only synchronize the tables that you have actually modified rather than perform an entire synchronization
class OTS_DBSynchronize extends RunBaseBatch
{
DialogField tableDlg;
TableName tableFld;
public container pack()
{
return conNull();
}
public boolean unpack(container packedClass)
{
return true;
}
public Object dialog()
{
Dialog dialog = super();
dialog.caption("@OTS:OTS_624_625_EURO_TON_Valorisation_03");
tableDlg = dialog.addField(extendedTypeStr(TableName), 'Table');
return dialog;
}
public boolean getFromDialog()
{
tableFld = tableDlg.value();
return super();
}
public void run()
{
appl.dbSynchronize(tableName2id(tableFld), false);
}
public static void main(Args _args)
{
OTS_DBSynchronize self = new OTS_DBSynchronize();
if (self.prompt())
{
self.run();
}
}
}
The class opens a dialog.
Insert your table and press OK
