Hello, so I have a grid on a form (VMDealerProductLine) that can be accessed by the same menu item but two different places. One being CustTableListPage, the other from the menus.
Based off a modification, we set an initial value to filter the grid in the init method of the data source CustTableCube. Currently, that filter is causing problems for users depending on which place they access the grid from(CustTableListPage or the menu).
My solution is to filter the route the system takes based off the access point used to access said form grid (VMDealerProductLine).
This is what I've done to do this:
public void init() { QueryBuildDataSource qbds; super(); gCallerForm = element.args().caller(); if (element.args().caller() && element.args().caller().name() == formStr(CustTableListPage)) { super(); qbds.addDataSource(TableNum(CustTableCube)); qbds.addRange(fieldNum(CustTableCube, CustGroup)); qbds.addLink(fieldNum(frFloorPlanAssignment, dealercustomer), fieldNum(CustTableCube, AccountNum)); qbds.addRange(fieldNum(frFloorPlanAssignment, EndDate)).value('>' queryValue(today()-1)); } else { super(); qbds.addDataSource(TableNum(CustTableCube)); qbds.addRange(fieldNum(CustTableCube, CustGroup)).value("Dealers"); qbds.addLink(fieldNum(frFloorPlanAssignment, dealercustomer), fieldNum(CustTableCube, AccountNum)); qbds.addRange(fieldNum(frFloorPlanAssignment, EndDate)).value('>' queryValue(today()-1)); }
Before I began making modifications such as my variable declaration up top, super() was running first. That would take me to my method init on CustTableCube which was setting the filter value when accessing VMDealerProductLine.
public void init()
{
/* QueryBuildDataSource qbds;
super();
qbds = this.queryBuildDataSource();
qbds.addRange(fieldNum(CustTableCube, CustGroup)).value("Dealers");*/
}
It would then move on to another init method on data source frFloorPlanassignment.
public void init()
{/*
super();
this.queryBuildDataSource().addLink(fieldNum(frFloorPlanAssignment, dealercustomer), fieldNum(CustTableCube, AccountNum));
this.queryBuildDataSource().addRange(fieldNum(frFloorPlanAssignment, EndDate)).value('>' queryValue(today()-1));*/
}
I tried setting up a parm method on the form which would hold the caller value and I can access that on the data source to tell super and CustTableCube which query build route to take.
It did not work because I'm guessing the variable was out of scope.
I thought it might be possible to take all those query modifications from those table init methods and add them here THEN call super(). But I'm getting an error saying QueryBuildDatasourceObject not initialized.
I wanted to see if anyone had any suggestions on how to accomplish my original goal.
Also, if anyone has clarification on what exactly super is doing with all of this and what I can use it for myself.