Hi All,
Is there a way to find and create the order by field in the x++ query using query classes? I have a scenario where i have extended the class and method from ISV called prepareQuery. In this method I have added a order by field. The code worked fine untill we took the lastest ISV release. It was observed that the ISV team have also added the same filed in the order by of the query because of which the same field is added twice in the query and thus a run time error for duplicate fileds is shown.
I wanted to know if there is a way to avoid such scenario in extensions. If we can validate the query and added order by field only if it does not exist in the query and if it exists the skip the code.
Example-
extensionof[classStr(xyzCalss)]
final class xyzClass_extension
{
public void prepareQuery ()
{
next prepareQuery();
QueryBuildDataSource qbds;
qbds = SysQuery::findOrCreateDataSource(qr.query(),tableNum(xyzTable));
//i need to validate if the query already have the abcField and skip the below code if it is present.
qbds.addOrderByField(fieldNum(xyzTable, abcField);
}
}