dinsdag 10 augustus 2010
num2str - decimals based on EDT
num2str function with the number of decimals based on the property of an Extended DataType
Code based on Mirko Bonello's work: http://dynamicsax-dev.blogspot.com/2009/02/getting-number-of-decimal-places-for.html
usage example:
Code based on Mirko Bonello's work: http://dynamicsax-dev.blogspot.com/2009/02/getting-number-of-decimal-places-for.html
str num2strEdt(
real _number, //The real number to convert to a string
int _character = 0, //The minimum number of characters required in the text.
ExtCodeValue _edt, //The EDT to be used as basis for required number of decimal places.
int _separator1 = 2, //DecimalSeparator
int _separator2 = 0) //ThousandSeparator
{
#DEFINE.AUTO('Auto')
// http://www.rgagnon.com/pbdetails/pb-0181.html
#DEFINE.LOCALE_USER_DEFAULT(1024)
#DEFINE.LOCALE_ICURRDIGITS(25)
#AOT
#PROPERTIES
#WinAPI // Used for regional settings
TreeNode treeNode;
int decimalPlaces;
;
treeNode = infolog.findNode(#ExtendedDataTypesPath + '\\' + _edt);
if (!treeNode)
return strfmt("%1", _number);
if (findproperty(treeNode.AOTgetProperties(),#PropertyNoOfDecimals) == #AUTO)
{
// get the number of decimals from the regional settings
decimalPlaces = str2int((WinAPI::getLocaleInfo(#LOCALE_USER_DEFAULT, #LOCALE_ICURRDIGITS)));
}
else
{
// get the number of decimals set by the developer in the property inspector
decimalPlaces = str2int(findproperty(treeNode.AOTgetProperties(),#PropertyNoOfDecimals));
}
return num2str(_number, _character, decimalPlaces, _separator1, _separator2);
}
usage example:
info(strfmt("%1", num2strEdt(20.34, 0, (identifierstr(myEDT)))));
vrijdag 6 augustus 2010
Remember network passwords after reboot (Vista home premium)
Source: http://www.osnn.net/windows-desktop-systems/88876-vista-home-premium-remember-network-passwords-after-reboot.html
Hi, I was having the same issue as you, and I was using Vista Ultimate 64bits,
I got it to work by doing this:
1 - Reboot the computer
2 - After you log it will say your mapped drive couldn't be connected and stuff.... ok
3 - Go into Control Pannel, User Accounts, Network Passwords, and add the \\server\share, with the username & password you want
4 - Open My Computer, and access your mapped drive
5 - Reboot the computer
After this, all the time windows boots up it shall reconnect without that f*cking message again
Notice: Its important to do the steps as described because if you only add the server password into the Network Passwords but you don't use it, windows will not store it and will not remember the password the next time you boot.
Enjoy!!
Hi, I was having the same issue as you, and I was using Vista Ultimate 64bits,
I got it to work by doing this:
1 - Reboot the computer
2 - After you log it will say your mapped drive couldn't be connected and stuff.... ok
3 - Go into Control Pannel, User Accounts, Network Passwords, and add the \\server\share, with the username & password you want
4 - Open My Computer, and access your mapped drive
5 - Reboot the computer
After this, all the time windows boots up it shall reconnect without that f*cking message again
Notice: Its important to do the steps as described because if you only add the server password into the Network Passwords but you don't use it, windows will not store it and will not remember the password the next time you boot.
Enjoy!!
donderdag 5 augustus 2010
Interactive Infolog messages: SysInfoAction
Ever wanted to doubleclick an infolog message and go straight to a form/field... ?
See:
http://www.axaptapedia.com/SysInfoAction_class
http://www.eggheadcafe.com/software/aspnet/35484927/sysinfoaction--open-form-with-parameters-from-infolog.aspx
http://alexvoy.blogspot.com/2008/04/sysinfoaction-and-infolog.html
See:
http://www.axaptapedia.com/SysInfoAction_class
http://www.eggheadcafe.com/software/aspnet/35484927/sysinfoaction--open-form-with-parameters-from-infolog.aspx
http://alexvoy.blogspot.com/2008/04/sysinfoaction-and-infolog.html
Outputting the Name of an Enum element, instead of its Label
Example:
Enum WorkTimeControl has 3 elements:
Name - Label - EnumValue: (labels are in Dutch)
Open - Openen - 0
Closed - Afgesloten - 1
UseBasic - Basiskalender - 2
We define a variable:
WorkTimeControl workTimeControl = WorkTimeControl::Closed;
This code will render the Label of the element:
info(strfmt("%1", workTimeControl));
output = Afgesloten
This code will render the Name of the element:
info(strfmt("%1", enum2symbol(enumnum(WorkTimeControl), workTimeControl)));
output = Closed
Enum WorkTimeControl has 3 elements:
Name - Label - EnumValue: (labels are in Dutch)
Open - Openen - 0
Closed - Afgesloten - 1
UseBasic - Basiskalender - 2
We define a variable:
WorkTimeControl workTimeControl = WorkTimeControl::Closed;
This code will render the Label of the element:
info(strfmt("%1", workTimeControl));
output = Afgesloten
This code will render the Name of the element:
info(strfmt("%1", enum2symbol(enumnum(WorkTimeControl), workTimeControl)));
output = Closed
WorkCalendarDate::findDate
A new useful method on Table WorkCalendarDate:
\Data Dictionary\Tables\WorkCalendarDate\Methods\findDate
Example Job:
\Data Dictionary\Tables\WorkCalendarDate\Methods\findDate
/// <summary>
/// Searches the nth day of type _workTimeControl, forward or backwards from _startDate
/// </summary>
/// <param name="_calendarId">
/// The calendar to use to look for open days
/// </param>
/// <param name="_lookAheadDays">
/// Search for the nth day (default 0)
/// positive value = search forward
/// negative value = search backwards
/// </param>
/// <param name="_startDate">
/// Start looking from this date (default: system date)
/// </param>
/// <param name="_forceReturnDate">
/// What should be returned if no date was found?
/// true = _startdate is returned
/// false = no date is returned (default)
/// </param>
/// <param name="_workTimeControl">
/// Look for which type of days?
/// Open (default)
/// Closed
/// UseBasic
/// </param>
/// <returns>
/// The nth day (_lookAheadDays) of type _workTimeControl, starting from _startDate
/// </returns>
/// <remarks>
/// location = \Data Dictionary\Tables\WorkCalendarDate\Methods\findDate
/// </remarks>
static TransDate findDate(
CalendarId _calendarId,
Counter _lookAheadDays = 0,
TransDate _startDate = systemDateGet(),
boolean _forceReturnDate = false,
WorkTimeControl _workTimeControl = WorkTimeControl::Open)
{
WorkCalendarDate workCalendarDate;
Counter counter = 0;
;
if (_lookAheadDays >= 0) //search forward from _startDate
{
while
select workCalendarDate
order by TransDate
where workCalendarDate.CalendarId == _calendarId
&& workCalendarDate.TransDate >= _startDate
&& workCalendarDate.WorkTimeControl == _workTimeControl
{
if (counter >= _lookAheadDays)
return workCalendarDate.TransDate;
counter++;
}
}
else //search backward from _startDate
{
while
select workCalendarDate
order by TransDate DESC
where workCalendarDate.CalendarId == _calendarId
&& workCalendarDate.TransDate <= _startDate
&& workCalendarDate.WorkTimeControl == _workTimeControl
{
if (counter <= _lookAheadDays)
return workCalendarDate.TransDate;
counter--;
}
}
//no date found
if (_forceReturnDate)
return _startDate;
else
return dateNull();
}
Example Job:
static void WorkCalendarDate_findDate(Args _args)
{
CalendarId calendarId;
TransDate startDate;
TransDate nextDate;
Counter offsetDays;
Name startDateName;
Name nextDateName;
boolean forceReturnDate;
WorkTimeControl workTimeControl;
;
//Example 1:
//Search 3 days forward in calendar STD, starting from 05 AUG 2010 (thursday), looking for Open days
calendarId = "STD";
startDate = str2date("05/08/2010",123);
offsetDays = 3;
forceReturnDate = false;
workTimeControl = WorkTimeControl::Open;
nextDate = WorkCalendarDate::findDate(
calendarId,
offsetDays,
startDate,
forceReturnDate,
workTimeControl);
startDateName = dayname(dayofwk(startDate));
nextDateName = dayname(dayofwk(nextDate));
global::enum2int(
info(strfmt("Search %1 days, starting from %2(%3), with an offset of %4 days = %5(%6)",
workTimeControl,
startDate,
startDateName,
offsetDays,
nextDate,
nextDateName)));
//output:
//Search Openen days, starting from 5/08/2010(thursday), with an offset of 3 days = 10/08/2010(tuesday)
//Example 2:
//Search 3 days backwards in calendar STD, starting from 11 AUG 2010 (wednesday), looking for Open days
calendarId = "STD";
startDate = str2date("11/08/2010",123);
offsetDays = -3;
forceReturnDate = false;
workTimeControl = WorkTimeControl::Open;
nextDate = WorkCalendarDate::findDate(
calendarId,
offsetDays,
startDate,
forceReturnDate,
workTimeControl);
startDateName = dayname(dayofwk(startDate));
nextDateName = dayname(dayofwk(nextDate));
global::enum2int(
info(strfmt("Search %1 days, starting from %2(%3), with an offset of %4 days = %5(%6)",
workTimeControl,
startDate,
startDateName,
offsetDays,
nextDate,
nextDateName)));
//output:
//Search Openen days, starting from 11/08/2010(wednesday), with an offset of -3 days = 6/08/2010(friday)
}
Labels:
Calendar,
Date,
WorkCalendarDate,
WorkTimeControl,
X++
dinsdag 3 augustus 2010
Fitting Non-Dimensional Inventory into Dynamics AX’s Dimensional Inventory Model
See http://kamalblogs.wordpress.com/2010/07/26/fitting-non-dimensional-inventory-into-dynamics-axs/
See http://lilmikey.com/?p=278
See http://lilmikey.com/?p=278
Labels:
Dimensional,
Dimensions,
Inventory,
Non-Dimensional
Abonneren op:
Posts (Atom)