Is it possible to use regular expressions in QueryBuildRange value method?
I want to get the name of the countries that start with an English Alphabet (a-zA-Z).
The SQL query is working perfectly in the SQL Server Management Studio and is as:
select TRANS.COUNTRYREGIONID, SHORTNAME from [AxDB].[ax].[LOGISTICSADDRESSCOUNTRYREGIONTRANSLATION] as TRANS, [AxDB].[ax].[LOGISTICSADDRESSCOUNTRYREGION] as COUNTRY where COUNTRY.COUNTRYREGIONID = TRANS.COUNTRYREGIONID and SHORTNAME like '[a-zA-Z]%' group by TRANS.COUNTRYREGIONID, SHORTNAME;
The query returns the following (only 3 records are shown to indicate what I am trying to achieve):
CountryRegionId | ShortName |
---|---|
AUS | Australia |
ARG | Argentina |
BRA | Brazil |
... | ... |
The LogisticsAddressCountryRegion and LogisticsAddressCountryRegionTranslation have been added to a form as FormDataSource, and LogisticsAddressCountryRegionTranslation is InnerJoin'd to the LogisticsAddressCountryRegion via CountryRegionId foreign key relation. What I want is to display the CountryRegionId and ShortName on a grid control on a form and have changed the parent datasource's executeQuery() method as:
public void executeQuery() {
this.query().dataSourceTable(tableNum(LogisticsAddressCountryRegionTranslation)) .addRange(fieldNum(LogisticsAddressCountryRegionTranslation, ShortName)) .value(Global::queryValue('[a-zA-Z]*')); this.query().dataSourceTable(tableNum(LogisticsAddressCountryRegion)) .addGroupByField(fieldNum(LogisticsAddressCountryRegion, CountryRegionId)); this.query().dataSourceTable(tableNum(LogisticsAddressCountryRegionTranslation)) .addGroupByField(fieldNum(LogisticsAddressCountryRegionTranslation, ShortName)); super(); }