how to insert a record in table based on form caller?

Hi,

Created form A and form B with the same datasource.

like

FormA - DS- TableA

FormB - DS- TableA

TableA having one Baseenum with the elements like Purchase and Sales.

NOw the req is:

when i click the button - FormA- should open and record is inserted along with base enum value “Purchase”

when i click the button - FormB- should open and record is inserted along with base enum value “Sales”

both formA and formB have Same DS.

Can any one help me on this…

Thanks

You probably don’t need FormA and FormB, but you can use the same form.

In the init method of the FormA/B, you would use element.args().record() to get the parent record, and element.args().caller() to get the parent form object.

Use just one form, check the caller of the form and in init like Alex said in the last post, and them overwrite the executeQuery method in your DataSource so you create another filter based in the QueryBuildRange object.

QueryBuildRange qbr;

qbr = qbds.addRange(fieldnum(PurchTable, PurchStatus));
qbr.value(valueOfStatus);

them just use this range in your query.

Thanks Alex…

Form A having WorkFlow and Form B not having workFlow in that case how can i use same form for both.

so that is the reason i created 2forms with same DS.

How to insert recrod when i click FormA with base enum value “Purchae”

and FormB with Base enum Value “Sales”

FormA datasource.initvalue()
{

datasource.field = enum::Purchase;
super();
}

FormB datasource.initvalue()
{

datasource.field = enum::Sales;
super();
}