This post will shows the steps required to filter records on form using parameters provided by the caller.
Step 1
Declare a class variable
In the ClassDeclaration method of form declare a QueryBuildRange
class FormRun extends ObjectRun
{
QueryBuildRange abcQueryRange;
ABC abcCode;
}
Step 2
Initialize this range in the init method of datasource after super() call.
public void init()
{
super();
abcQueryRange = this.query().dataSourceName('X').addRange(fieldnum(X, ABC));
}
Step 3
Now assign the filter value in the executeQuery method of same datasource before super() call.
public void executeQuery()
{
if (abcCode)
{
abcQueryRange.value(queryValue(abcCode));
}
super();
}
The query filtration part is done, you now need to fetch the value of "abcCode" from the caller. For this you need to grab the values from argument passed by the caller in the "init" method form.
public void init()
{
if (element.args().record())
{
if (element.args().record().TableId == tablenum(x))
{
abcCode
= X::findRecId(element.args().record().RecId).abcCode;
}
}
super();
}
Step 1
Declare a class variable
In the ClassDeclaration method of form declare a QueryBuildRange
class FormRun extends ObjectRun
{
QueryBuildRange abcQueryRange;
ABC abcCode;
}
Step 2
Initialize this range in the init method of datasource after super() call.
public void init()
{
super();
abcQueryRange = this.query().dataSourceName('X').addRange(fieldnum(X, ABC));
}
Step 3
Now assign the filter value in the executeQuery method of same datasource before super() call.
public void executeQuery()
{
if (abcCode)
{
abcQueryRange.value(queryValue(abcCode));
}
super();
}
The query filtration part is done, you now need to fetch the value of "abcCode" from the caller. For this you need to grab the values from argument passed by the caller in the "init" method form.
public void init()
{
if (element.args().record())
{
if (element.args().record().TableId == tablenum(x))
{
abcCode
= X::findRecId(element.args().record().RecId).abcCode;
}
}
super();
}
No comments:
Post a Comment