How to add datasource to dialog form through code?

Hi all,

I need to add datasource to dialog form through code for the purpose of using segmented entry in dialog form.

I need to call (LedgerjournalTrans)datasource in init method of form to proceed with segmented entry with financial dimensions.

form name is: CustWriteOFF and corresponding class is : CustWriteOff

Please help me.

Thanks in advance


Why do you want to add the data source at runtime if you already know at design time that you’ll need it?

Hi Martin,

When I open the form I need to add data source at run time in dialog form.

My lead told me that Instead of adding a data source at design level of dialog form better to add at run time to call the data source in init method of form for segmented entry control as per below.

Is there any possibility to add data source at run time?

ledgerDimensionAccountController = LedgerDimensionAccountController::construct(ledgerjournaltrans_DS,


(LedgerJournalTrans, LedgerDimension));



I don’t think it’s possible. I know you can change the table to which an existing data source is bound, but I’ve never seen adding a complete data source at runtime. Ask your lead how to do it and let me know if there is something I should learn. Nevertheless even if it’s possible, I don’t see how it can be better than adding the data source at design time.