Hi,
Using below lines before super() call in init() of the form, the form will open in AX Workspacewindow only.
if(this.form().design().windowType()==FormWindowType::Standard)
this.form().design().windowType(FormWindowType::Workspace);
Thanks.
Tuesday, July 19, 2011
Tuesday, July 5, 2011
Filtering different file types in a browse dialog
Hi,
to filter the different types of files in a browse dialog,
to filter the different types of files in a browse dialog,
public Object dialog()
{
DialogRunbase dialog = super();
#AviFiles
#Excel
dialogFilename = dialog.addField(typeId(FilenameOpen));
dialog.filenameLookupFilter(["@SYS28576",#XLSX,"@SYS100852","*.csv"]);
dialog.filenameLookupTitle("Upload from EXCEL/CSV");
dialogFilename.value(filename);
return dialog;
}
{
DialogRunbase dialog = super();
#AviFiles
#Excel
dialogFilename = dialog.addField(typeId(FilenameOpen));
dialog.filenameLookupFilter(["@SYS28576",#XLSX,"@SYS100852","*.csv"]);
dialog.filenameLookupTitle("Upload from EXCEL/CSV");
dialogFilename.value(filename);
return dialog;
}
To build a LIKE query in AX 2009
Hi,
to build a QueryRun object same as LIKE SQL query.
void createQuery()
{
Query query = new Query();
QueryRun queryRun;
BOMTable bt;
InventTable it;
BOMId bomId;
;
it = InventTable::find('ELB002');
query.addDataSource(tableNum(BOMTable)).addRange(fieldNum(BOMTable, BOMId)).value(strfmt("%1-*",it.ItemId));
queryRun = new QueryRun(query);
bomId = strfmt("%1-%2",it.ItemId, SysQuery::countTotal(queryRun)+1);
info(bomId);
}
Also review for more details QueryRanges
Hope it helps.
Thanks,
/Ashlesh
to build a QueryRun object same as LIKE SQL query.
void createQuery()
{
Query query = new Query();
QueryRun queryRun;
BOMTable bt;
InventTable it;
BOMId bomId;
;
it = InventTable::find('ELB002');
query.addDataSource(tableNum(BOMTable)).addRange(fieldNum(BOMTable, BOMId)).value(strfmt("%1-*",it.ItemId));
queryRun = new QueryRun(query);
bomId = strfmt("%1-%2",it.ItemId, SysQuery::countTotal(queryRun)+1);
info(bomId);
}
Also review for more details QueryRanges
Hope it helps.
Thanks,
/Ashlesh
To find MAX, MIN, COUNT of any table in AX 2009
Hi,
Below is the code snipet to find out the MAX value of a particular field in a particular table.
static void MaxValueTest(Args _args)
{
str maxValue(TableId tableId, FieldId fieldId)
{
QueryRun qr = new QueryRun(new Query());
qr.query().addDataSource(tableId).addSelectionField(fieldId, SelectionField::Max);
return qr.next() ? any2str(qr.get(tableId).(fieldId)) : '';
}
;
info(maxValue(tableNum(BOMTable), fieldNum(BOMTable,BOMId)));
}
In the above example the "SlecttionField" has the mulitple static filed which can give you more choices.
Thanks,
/Ashlesh
Below is the code snipet to find out the MAX value of a particular field in a particular table.
static void MaxValueTest(Args _args)
{
str maxValue(TableId tableId, FieldId fieldId)
{
QueryRun qr = new QueryRun(new Query());
qr.query().addDataSource(tableId).addSelectionField(fieldId, SelectionField::Max);
return qr.next() ? any2str(qr.get(tableId).(fieldId)) : '';
}
;
info(maxValue(tableNum(BOMTable), fieldNum(BOMTable,BOMId)));
}
In the above example the "SlecttionField" has the mulitple static filed which can give you more choices.
Thanks,
/Ashlesh
Wednesday, June 29, 2011
Implement "Go to the Main Table" on the field
Hi,
To implement the "Go to the Main Table" functionality on any lookup field :
Override the jumpRef() method of the control,
public void jumpRef()
{
CustTable custTable;
Args args;
MenuFunction menuFunction;
;
custTable = CustTable::find(this.text());
if (!custTable)
{
return;
}
args = new Args();
args.caller(element);
args.record(custTable);
menuFunction = new MenuFunction(
menuitemdisplaystr(CustTable),
MenuItemType::Display);
menuFunction.run(args);
}
Thanks.
To implement the "Go to the Main Table" functionality on any lookup field :
Override the jumpRef() method of the control,
public void jumpRef()
{
CustTable custTable;
Args args;
MenuFunction menuFunction;
;
custTable = CustTable::find(this.text());
if (!custTable)
{
return;
}
args = new Args();
args.caller(element);
args.record(custTable);
menuFunction = new MenuFunction(
menuitemdisplaystr(CustTable),
MenuItemType::Display);
menuFunction.run(args);
}
Thanks.
To count total records from the customized query
Hi,
Below is the code to count the total no. of records using QueryRun.
q = new Query();
qbd = q.addDataSource(TableNum(BOMVersion));
qbr = qbd.addRange(FieldNum(BOMVersion, ItemId));
qbr.value("ELB008");
qr = new QueryRun(q);
info(strfmt("Total Record: %1", SysQuery::countTotal(qr)));
Thanks,
/Ashlesh
Below is the code to count the total no. of records using QueryRun.
q = new Query();
qbd = q.addDataSource(TableNum(BOMVersion));
qbr = qbd.addRange(FieldNum(BOMVersion, ItemId));
qbr.value("ELB008");
qr = new QueryRun(q);
info(strfmt("Total Record: %1", SysQuery::countTotal(qr)));
Thanks,
/Ashlesh
Subscribe to:
Posts (Atom)