27 July 2012

Dialog in class

class TestDialogClass
{
DialogField fromDate, toDate;

FromDate fDate;
ToDate tDate;
}
----
protected void dialog()
{
Dialog dialog;
DialogField field;
;

dialog = new Dialog("My Dialog");

field = dialog.addField(extendedTypeStr(VendAccount)); // add EmplId field

dialog.run(); // show

if (dialog.closedOK())
{
info(field.value());
}
}
----
public static void main(Args args)
{
TestDialogClass tClass = new TestDialogClass();

tClass.dialog();
}

03 July 2012

Full Text Index in AX 2012 – X++

A full text index contains location information about each significant word in a string field of a table. Some queries can use this information to run more efficiently and complete much sooner. These are queries that search for words that are embedded in the middle of string fields

A table can have a full text index only if the TableGroup property is set to Main or Group on the table.

You can create a maximum of one full text index per table.

static void GmFTIndexQueryJob6(Args _args)
{
FtiTable recFtiTable; // Specified in the prerequisite topic.

Query query2;
QueryBuildDataSource queryBDSource3;
QueryBuildRange queryBRange4;
QueryRun queryRun5;

print "Start the job.";

// Ensure the proper test data is in the table.
delete_from recFtiTable;
recFtiTable.Field1 = "Shine on you crazy diamond.";
recFtiTable.Field2 = "Record 1.";
recFtiTable.insert();
recFtiTable.Field1 = "And if there is no room upon the hill.";
recFtiTable.Field2 = "Record 2.";
recFtiTable.insert();

// Construct and run a query that uses
// the QueryRangeType::FullText enum value.
query2 = new Query();
queryBDSource3 = query2.addDataSource(tableNum(FtiTable));
queryBRange4 = queryBDSource3.addRange(fieldNum(FtiTable, Field1));

queryBRange4.rangeType(QueryRangeType::FullText);

// The space character is treated as a Boolean OR.
queryBRange4.value("diamond unfounded");

// Loop through the records that are returned by the query.
queryRun5 = new QueryRun(query2);
while (queryRun5.next())
{
recFtiTable = queryRun5.get(tableNum(FtiTable));
print "--------";
print "Field1 == " + recFtiTable.Field1;
print "Field2 == " + recFtiTable.Field2;
}
print "End the job.";
pause;
}

Ledger Voucher creation Framework and x++ code to create ledger voucher

 Please click her for MS reference file Below is the out of the box example reference and code. SalesInvoiceJournalPostSubBill_Extension-...