Skip to main content

Posts

Showing posts with the label axapta query

Definiaion of Queries in MSD Axapta

Queries in the AOT are predefined static queries that can be reused throughout the whole application. A query contains a hierarchy of data sources that defines the data that should be available for the query. Queries can also be used by other elements in AX such as in forms, reports, and classes. You can add any numbers of tables to query.For example salesTable and SalesLine table relation is salesid field you can create query using salesid field. Query can be used with reports. You can add query in datasources.

Select first fast Query in MSD axapta

panauthormaster authormaster; int i; ; select authormaster order by authormaster.BookID; i=authormaster.BookID; print(i); select firstfast authormaster order by authormaster.BookID; i=authormaster.BookID; print(i); select firstonly authormaster order by authormaster.BookID; i=authormaster.BookID; print(i); select forceliterals authormaster order by authormaster.BookID; i=authormaster.BookID; print(i); pause;

Execute sql query in axapta

static server ResultSet executeSqlWithResult(str _sql) { Connection sqlConnection; Statement sqlStatement; ResultSet sqlResultSet; SqlStatementExecutePermission perm; ; sqlConnection = new Connection(); sqlStatement = sqlConnection.createStatement(); perm = new SqlStatementExecutePermission(_sql); perm.assert(); sqlResultSet = sqlStatement.executeQuery(_sql); CodeAccessPermission::revertAssert(); return sqlResultSet; } static server int executeSqlStatement(str _sql) { Connection sqlConnection; Statement sqlStatement; SqlStatementExecutePermission perm; str sql; int result; ; sqlConnection = new Connection(); sqlStatement = sqlConnection.createStatement(); perm = new SqlStatementExecutePermission(_sql); perm.assert(); result = sqlStatement.executeUpdate(_sql); CodeAccessPermission::revertAssert(); return result;

use of OLAP Datasource in axapta

QueryName querySource; OLAPDatasourceRange DSRange; OLAPDatasourceRelation DSRelation; OLAPDatasource datasource; OLAPDatasourceField DSField; Query query; QueryBuildDataSource buildDatasource, parentBuildDataSource; int i,dim, parentIndex; int dsCount; boolean newDim; DictTable dictTable; QueryBuildDataSource ds; QueryBuildRange br; Range _rangeStr; DictTable dictTable1; DictField dictField; ; querySource = 'Bbde'; query = new Query (querySource); dsCount = query.dataSourceCount(); buildDatasource = query.dataSourceNo(1); dictTable = new DictTable(buildDatasource.table()); print dictTable.name(); pause; br = buildDatasource.range(1); dictTable1 = new DictTable(br.table()); dictField = new DictField(br.table(),br.field()); // br.value(strfmt('%1',mkdate(6,6,2008))); _rangeStr = br.toString(); print br; print br.field(); print _rangeStr; pause;