donderdag 12 augustus 2010

Brief description of ways to close a form in AX

See http://kashperuk.blogspot.com/2010/07/tutorial-brief-description-of-ways-to.html

There are “only” 5 ways to close a form:
  • Close - close the form. Similar to the 'X' button.
  • CloseOK – close the form, and set the OK flag – called by the Commandbutton::Ok
  • CloseCancel – close the form, and set the Cancel flag – called by the Commandbutton::Cancel
  • CloseSelectRecord – close the lookup form, and set return record
  • CloseSelect – close the lookup form, and set return value
The below methods (note their names are in past-tense) are used to determine if or how a form was closed:
  • Closed – Returns true, if the form is no longer open
  • ClosedOK – Return true, if the form was closed by the user clicking ‘OK’
  • ClosedCancel – Returns true, if the form was closed by the user clicking ‘Cancel’
Finally, CanClose() is called before any of the close methods get called. If CanClose() returns false, the form is not allowed to close.

dinsdag 10 augustus 2010

Adding Find\Filter functionality on Display method

See http://matrishmangal.blogspot.com/2010/05/adding-findfilter-functionality-on.html

Inside SalesFormLetter class : ReArrange

See http://www.ksaelen.be/wordpress/2010/08/inside-salesformletter-class-rearrange/

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


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!!

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

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