CASE:
In the project module you can create item requirements for a project (which are basically items you sell via the project). At a customer site, a customized table and form, has been added to the item requirements forms, so the customer is able to set up item specifications for each item requirement, consisting of records with different kinds of data which describes the item.
A class bas been made to import a .csv-file to an set of intermediate tables where data which forms the basis of item requirements and item specifications are stored.
On the item requirements form, you can call a form showing the contents of the intermediate tables and from this form you can then (via a menuitem button) call a class that facilitates population of the item requirements AND item specifications from the itermediate table. When populating the item requirements table based on the intermediate table, you deleted the contents of the intermediate table.
So you have the
Project form calling the
Item Requirements form
calling the Intermediate table form,
from where you perform the population of item requirements and specification.
PROBLEM:
How do you refresh the Item requirements form, and the itermediate table form to show that data has been "moved" from the intermediate form to the item requirements form WITH ONE METHOD CALL.
SOLUTION:
On the class performing the population i added a method that recursively examines the args object to see if the caller is a form, and then call the executequery method on the form datasource:
void doCallingFormsRefresh(Args _args)
{
FormDataSource fds;
Args prevLevelArgs;
// refresh calling form
if (_args.caller() && _args.dataset() && _args.record().isFormDataSource())
{
// Previous level of args (args from caller's caller)
prevLevelArgs = _args.caller().args();
fds = _args.record().dataSource();
fds.executeQuery();
if (prevLevelArgs && prevLevelArgs.record().TableId != tablenum(ProjTable) && prevLevelArgs.record().isFormDataSource())
{
this.doCallingFormsRefresh(prevLevelArgs);
}
}
}
Notice that the Projtable form is NOT refreshed.
This way I avoided all the tedious call back methods on the forms, that is normally done.
:)
In the project module you can create item requirements for a project (which are basically items you sell via the project). At a customer site, a customized table and form, has been added to the item requirements forms, so the customer is able to set up item specifications for each item requirement, consisting of records with different kinds of data which describes the item.
A class bas been made to import a .csv-file to an set of intermediate tables where data which forms the basis of item requirements and item specifications are stored.
On the item requirements form, you can call a form showing the contents of the intermediate tables and from this form you can then (via a menuitem button) call a class that facilitates population of the item requirements AND item specifications from the itermediate table. When populating the item requirements table based on the intermediate table, you deleted the contents of the intermediate table.
So you have the
Project form calling the
Item Requirements form
calling the Intermediate table form,
from where you perform the population of item requirements and specification.
PROBLEM:
How do you refresh the Item requirements form, and the itermediate table form to show that data has been "moved" from the intermediate form to the item requirements form WITH ONE METHOD CALL.
SOLUTION:
On the class performing the population i added a method that recursively examines the args object to see if the caller is a form, and then call the executequery method on the form datasource:
void doCallingFormsRefresh(Args _args)
{
FormDataSource fds;
Args prevLevelArgs;
// refresh calling form
if (_args.caller() && _args.dataset() && _args.record().isFormDataSource())
{
// Previous level of args (args from caller's caller)
prevLevelArgs = _args.caller().args();
fds = _args.record().dataSource();
fds.executeQuery();
if (prevLevelArgs && prevLevelArgs.record().TableId != tablenum(ProjTable) && prevLevelArgs.record().isFormDataSource())
{
this.doCallingFormsRefresh(prevLevelArgs);
}
}
}
Notice that the Projtable form is NOT refreshed.
This way I avoided all the tedious call back methods on the forms, that is normally done.
:)
Comments
Post a Comment