≡ Menu

Exploring the Full text index In Dynamics Ax 2012 R3

Consider following points for Full text index on Dynamics Ax 2012

  • Full text index used only on text fields on table.
  • They find all records from table which contains the key words
  • Queries can be used to and full text index used in range filters
  • If keywords contains spaces then it will used as “Or” operator.
  • X++ select statement cannot use full text index.

 

Let explore the full text index on our custom table “HSPatientTable”

2015-08-23_1-55-28

And we want full index search of FName of above mentioned table. First of all right click on table and from property window set table group property to “Main”.

2015-08-23_1-58-16

Now expand the full text Index node of table and create a new full index name it as IdxFName and drag drop the Fname in this index.

2015-08-23_2-00-55

Compile and synchronize table so changes reflect at sql server level.

 

Now create Now Ax job and paste following code there

static void Job1(Args _args)

{

HsPatientTable patientTable;

Query query;

QueryBuildDataSource queryBDSource;

QueryBuildRange queryBRange;

QueryRun queryRun; 

delete_from patientTable;

patientTable.HsPatientId ="01";

patientTable.FName =" Ali Raza zaidi";

patientTable.insert();

patientTable.HsPatientId ="02";

patientTable.FName =" Ranjah jogi";

patientTable.insert();

patientTable.HsPatientId ="03";

patientTable.FName ="Waseem akahram";

patientTable.insert();

patientTable.HsPatientId ="04";

patientTable.FName ="Shah jii";

patientTable.insert();

patientTable.HsPatientId ="05";

patientTable.FName ="AX guru";

patientTable.insert(); 

query = new Query();

queryBDSource = query.addDataSource(tableNum(HsPatientTable));

queryBRange = queryBDSource.addRange(fieldNum(HsPatientTable, FName));

 

queryBRange.rangeType(QueryRangeType::FullText);

 

// The space character is treated as a Boolean OR.

queryBRange.value("AX jii");

 

 

queryRun = new QueryRun(query);

while (queryRun.next())

{

patientTable = queryRun.get(tableNum(HsPatientTable));

info (" Patient Id: "  + patientTable.HsPatientId + " , Patient Name: " +patientTable.FName);

}

 

}

I used the value “AX jii”. The space between two words consider as Or and in result it will return two records

2015-08-23_13-41-18

{ 0 comments… add one }

Leave a Comment