//Add new variable and parm method to info class
Class declaration
boolean addressBarEvent;
boolean parmAddressBarEvent(boolean _addressBarEvent = addressBarEvent)
{
;
addressBarEvent = _addressBarEvent;
return addressBarEvent;
}
Do a forward compile
//Add a container object and parse the path to check if the user has selected change company option.
//If Yes, set the parm method info class.
\Classes\SysTaskRecorder_AddressbarEvents\fire_BreadcrumbBarNodeNavigate
container conStr; infolog.parmAddressBarEvent(false);
conStr = str2con(path,"\\");
if (conlen(conStr)== 2)
infolog.parmAddressBarEvent(true);
Do a forward compile
//In change default company check if the info parm method is set and perform the required action.
\Classes\Application\setDefaultCompany
if (dialog)
{
//set the applicable user groups
CAP_UserCompanyGroupServer::addUserGroupList();
SysSecurity::reload(false);
//infolog.runStartupMenu();
}
else if (infolog.parmAddressBarEvent())
{
//set the applicable user groups
CAP_UserCompanyGroupServer::addUserGroupList();
SysSecurity::reload(false);
//infolog.runStartupMenu();
infolog.parmAddressBarEvent(false);
}
Tuesday, March 27, 2012
Bread crumb bar event firing
Friday, March 16, 2012
Expr In Query For Dates
Class CustTransQueryAgingBucktetStat:
str dateNull;
Range rangeDocDate;
date sqlFromDate;
date sqlToDate;
str date2SqlStr(date _date)
{
str sqlDate;
if (_date == dateNull())
{
sqlDate = '01\\01\\1901';
}
else
{
if(_date == maxdate())
{
sqlDate = '31\\12\\2150';
}
else
{
sqlDate = date2str(_date, 123, 2, 3, 2, 3, 4);
sqlDate = strReplace(sqlDate, '-', '\\');
}
}
return sqlDate;
}
;
range = transDataSource.addRange(fieldnum(CustTrans, RecId));
sqlFromDate = statementEndDate ? statementStartDate : dateNull();
sqlToDate = statementEndDate ? statementEndDate : maxdate();
dateNull = date2StrXpp(dateNull());
rangeDocDate = '((DocumentDate >= ' + date2SqlStr(sqlFromDate) + ') &&';
rangeDocDate += '(DocumentDate <= ' + date2SqlStr(sqlToDate) + ')) ||';
rangeDocDate += '((DocumentDate = ' + dateNull + ') &&';
rangeDocDate += '(TransDate >= ' + date2SqlStr(sqlFromDate) + ') && ';
rangeDocDate += '(TransDate <= ' + date2SqlStr(sqlToDate) + '))';
range.value(rangeDocDate);
Using joins in Query
void initParmDefault()
{
Query query;
QueryBuildDataSource queryBuildDataSource,queryBuildDSProd;
QueryBuildRange queryBuildRange,queryBuildRangeStatus;
;
super();
query = new Query();
queryBuildDataSource = query.addDataSource(tablenum(InventTable));
queryBuildDataSource.addSelectionField(fieldnum(InventTable, ItemId));
queryBuildRange = queryBuildDataSource.addRange(fieldnum(InventTable, ItemType));
queryBuildRange.value(SysQuery::value(ItemType::BOM));
queryBuildRange.status(RangeStatus::Locked);
queryBuildDataSource.addRange(fieldnum(InventTable, itemId));
queryBuildDSProd = queryBuildDataSource.addDataSource(tablenum(ProdTable));
queryBuildDSProd.addSelectionField(fieldnum(prodTable,itemId));
queryBuildRangeStatus = queryBuildDSProd.addRange(fieldnum(ProdTable,ProdStatus));
queryBuildRangeStatus.value(SysQuery::range(ProdStatus::Created,ProdStatus::StartedUp));
queryBuildRangeStatus.status(RangeStatus::Locked);
queryBuildDSProd.joinMode(JoinMode::ExistsJoin);
queryBuildDSProd.fetchMode(QueryFetchMode::One2One);
queryBuildDSProd.addLink(fieldnum(inventTable,itemid),fieldnum(prodTable,itemId));
queryRun = new QueryRun(query);
//QueryRun = new QueryRun(querystr(InventTable));
}
Using Expression in Query
Note: when string field is used in filteration then "" should be used. In the below example GroupId is string and when integer fields is used, no need to used "".
void queryFilter()
{
AA_PriceDiscGroupBrand priceDiscGroupBrand;
str qbrValue,qbrGroupValue, qbrGroupValueAll;
int relationVal;
boolean recordFound = false;
;
while select Type, GroupId from priceDiscGroupBrand where
(prevDate >= priceDiscGroupBrand.FromDate || ! priceDiscGroupBrand.FromDate) &&
(prevDate <= priceDiscGroupBrand.ToDate || ! priceDiscGroupBrand.ToDate) &&
priceDiscGroupBrand.CustAccount == custAccount
{
recordFound = true;
if (priceDiscGroupBrand.Type == PriceGroupType::LineDiscGroup)
relationVal = 5;
if (priceDiscGroupBrand.Type == PriceGroupType::PriceGroup)
relationVal = 4;
qbrGroupValue = strFmt('(' +
'((%1.%2 == "%3") && (%1.%4 == %5) && (%1.%6 == %7))' +
')',
this.query().dataSourceNo(1).name(),
fieldStr(PriceDiscTable,AccountRelation),
priceDiscGroupBrand.GroupId,
fieldStr(PriceDiscTable,AccountCode),
1,
fieldStr(PriceDiscTable,Relation),
relationVal
);
if (!qbrGroupValueAll)
qbrGroupValueAll = qbrGroupValue;
else
qbrGroupValueAll = qbrGroupValueAll + '||' + qbrGroupValue;
}
if (recordFound)
{
qbrGroupValueAll = '(' + qbrGroupValueAll + ')';
qbrValue = strFmt('(' +
'((%1.%2 == "%3") && (%1.%4 == %5) && ((%1.%6 == %7) || (%1.%6 == %8)))'
+ '||' +
'((%1.%2 == "%9") && (%1.%4 == %10) && ((%1.%6 == %7) || (%1.%6 == %8)))'
+ '||' + qbrGroupValueAll +
')',
this.query().dataSourceNo(1).name(),
fieldStr(PriceDiscTable,AccountRelation),
custAccount,
fieldStr(PriceDiscTable,AccountCode),
0,
fieldStr(PriceDiscTable,Relation),
4,5,
"",
2
);
}
else
{
qbrValue = strFmt('(' +
'((%1.%2 == "%3") && (%1.%4 == %5) && ((%1.%6 == %7) || (%1.%6 == %8)))'
+ '||' +
'((%1.%2 == "%9") && (%1.%4 == %10) && ((%1.%6 == %7) || (%1.%6 == %8)))' + ')',
this.query().dataSourceNo(1).name(),
fieldStr(PriceDiscTable,AccountRelation),
custAccount,
fieldStr(PriceDiscTable,AccountCode),
0,
fieldStr(PriceDiscTable,Relation),
4,5,
"",
2
);
}
this.query().dataSourceNo(1).clearDynalinks();
this.query().dataSourceNo(1).clearRanges();
this.query().dataSourceTable(tableNum(PriceDiscTable)).addRange(fieldNum(PriceDiscTable,recid)).value(qbrValue);
}
Thursday, February 23, 2012
AllowEdit setting for all form datasource fields
void AA_editSales()
{
SysDictTable dictTable = new SysDictTable(tablenum(salestable));
Counter i;
fieldId fieldId;
;
salesTable_ds.allowCreate (false);
salesTable_ds.allowEdit (salesTableForm.editHeaderAllowed());
salesTable_ds.allowDelete (false);
if (salesTableForm.editHeaderAllowed())
{
for (i=1; i<=dictTable.fieldCntWithoutSys() ;i++)
{
fieldId = dictTable.fieldCnt2Id(i);
switch (fieldId)
{
case fieldnum(salestable,URL):
SalesTable_DS.object(dictTable.fieldCnt2Id(i)).allowEdit(true);
break;
default:
SalesTable_DS.object(dictTable.fieldCnt2Id(i)).allowEdit(false);
}
}
}
}
Calling menu string using args, formrun using args
Args args = new Args();
;
switch (_menuItemName)
{
case menuitemoutputstr(PurchPackingSlipCopy) :
args.record(vendPackingSlipJour);
new Menufunction(menuitemoutputstr(PurchPackingSlipCopy),MenuItemType::Output).run(args);
break;
case menuitemoutputstr(PurchPackingSlipOriginal) :
args.record(vendPackingSlipJour);
new Menufunction(menuitemoutputstr(PurchPackingSlipOriginal),MenuItemType::Output).run(args);
break;
case menuitemoutputstr(PurchPackingSlip) :
args.record(vendPackingSlipJour);
new Menufunction(menuitemoutputstr(PurchPackingSlip),MenuItemType::Output).run(args);
break;
}
Args args = new Args();
FormRun formRun;
;
args.name( formstr(SalesTable) );
args.caller(this); args.record(salesTable);
args.parm("OrderAmendment");
formRun = classFactory.formRunClass( args );
formRun.init();
formrun.run();
formrun.wait();
Wednesday, February 22, 2012
Connecting to Dynamics AOS Services on Remote destop
Here is a cool tip, if you don't want to connect to a remote computer where the AOS is running to start and stop the AOS Services. You can just go to Services, Right-click the services and click "Connect to another computer". The authentication (login) should be same for the current system and the Remote desktop.![]()
Subscribe to:
Posts (Atom)
