initialize table

Hi,

i am using 1 class which works corectly with custinvoicejour and with vendinvoicejour, and i dont want to create two classes because of this declaration sentence: VendInvoiceJour vendInvoicejour; and in another class CustinVoiceJour custinvoicejour;

How i can dynamically define table which depends on which form button was clicked?

Hello,

You can use ‘common’ table which is the base class for all tables.

switch (_common.TableId)
{

case tablenum(CustInvoiceJour):

break;

}

And how to use it? In run() i use vendInvoiceJour table name. How can i define vendinvoicejour depending on datasource?

Hi, You have to pass the argument from form button to the class and check the condition whether the argument tableid is custinvoicejour or vendinvoicejour and perform other operations. For reference, see Markupallocation class, construct method. Regards, Kuppusamy S

so what i didt now, i made initvalue method, and in run method i have quite big code with vend table, so i made switch, and but another case with cust. The problem is that i have to double the code just for another table :slight_smile: but i will try with construct method. thanks