i want to add datasource on condition , for this i write following code on the init of the datasource:
if (ctrlShowAllStatus.value() == 0)
dsAssetTable = this.query().dataSourceTable(tableNum(AssetTable));
dsAssetBook = dsAssetTable.addDataSource(tableNum(AssetBook), tableStr(AssetBook));
statusRange = dsAssetBook.addRange(fieldnum(AssetBook, Status));
but init is called when form opens for the first time. i want that datasource is added based on condition.