Datasource at runtime

HI Friends,

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));
dsAssetBook.relations(true);
dsAssetBook.joinMode(JoinMode::ExistsJoin);

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.

Pls help!

thanks

Hi,

Can you please explain your requirement? Above one is not clear.

hi Saju

i have a form say F having datasource D . Now now on the init of D i write the above code. in above code i have added a second datasource with existjoin to the first.

But my requirement is that , the second datasource should be added on condition. if condition is false then only main datasource is there and when condition is applied the second datasource is added .