Tuesday, August 23, 2011

Excel Value to String

Query: How can i create a generic method for returning string values from excel.

Answer:

// convert into str from excel cell value
str COMVariant2Str(COMVariant _cv,
                    int _decimals = 0,
                        int _characters = 0,
                        int _separator1 = 0,
                        int _separator2 = 0)
{
    switch (_cv.variantType())
    {
        case (COMVariantType::VT_BSTR):
            return _cv.bStr();

        case (COMVariantType::VT_R4):
            return num2str(_cv.float(),_characters,_decimals,_separator1,_separator2);

        case (COMVariantType::VT_R8):
            return num2str(_cv.double(),_characters,_decimals,_separator1,_separator2);

        case (COMVariantType::VT_DECIMAL):
            return num2str(_cv.decimal(),_characters,_decimals,_separator1,_separator2);

        case (COMVariantType::VT_DATE):
            return date2str(_cv.date(),123,2,1,2,1,4);

        case (COMVariantType::VT_EMPTY):
            return "";

        default:
            throw error(strfmt("@SYS26908", _cv.variantType()));
    }
    return "";
}

Wednesday, August 17, 2011

Corrupted applicationHost.config

Query:
The IIS file applicationHost.config got corrupted today, is there any way i can regenerate?

Answer:
You can restore from the backup placed at C:\inetpub\history

Monday, August 15, 2011

ssrs unable to load client print control on windows 2003

Query:
I am getting an issue when trying to print the SSRS reports. It keeps saying "unable to load client print control".


Answer:

Uninstall KB KB956390

Sunday, July 24, 2011

Dynamics AX Workflow Purchase Requistion

Queries:
I can not create purchase requisition on behalf of other users?

Answer:
Go to HR->Employee Details->Setup->on behalf of to setup employees on behalf of whom you want to create PR's.

Thursday, July 21, 2011

How to check configuration key in X++

Query:
How can i check if the configuration key is enabled through x++?

Answer:
if (isConfigurationKeyEnabled(configurationkeynum(keyname)))
{
//insert code here
}

Sunday, July 17, 2011

SSRS Deployment Issue "Not Found"

Query:
I am getting a "Not Found" issue when deploying SSRS components.

Answer:
Install KB957312.

Sunday, July 10, 2011

Sunday, June 26, 2011

Call webservice using SQL Server

Query:
How can I call an AIF service using SQL Server 2008?

Answer:
You can use http://technet.microsoft.com/en-us/sqlserver/ff686773.aspx to see how it is done.

Wednesday, June 22, 2011

Dynamics AX Run Time Dialog

Query:
Can I create a dialog on run time?

Answer:
Use the following class
///

///  This is a class to create dynamic dialog on the fly
///

///
/// Usage
/*
static void testDynamicDialog(Args _args)
{
  CustomDialog   diag;
  List           types = new List(Types::Integer); // typeId is an integer
  List           fields;
  ListEnumerator enum;
  DialogField    field;
  ;

  // the dialog shall contain fields for the following types
  types.addEnd(typeId(EmplId));
  types.addEnd(typeId(Itemid));
  types.addEnd(typeId(ProdId));
  types.addEnd(typeId(CustAccount));

  // crate and show
  diag = new CustomDialog(types,"Dynamic Dialog");
  diag.run();

  // show values in the Infolog
  fields = diag.parmFieldList();
  enum   = fields.getEnumerator();

  while(enum.moveNext())
  {
    field = enum.current();
    info(field.value());
  }
} */
///


class MSTACustomDialog extends Dialog
{
    List fieldList;
}


public List parmFieldList()
{
    return fieldList;
}

void new(List typeList, Caption _caption = '', Object _caller = null, str _parmstr = '', Form _form = new Form(formStr(Dialog)))
{
    ListEnumerator enum;
    ;

    if(typeList == null)
      error("@BCS3969");

    super(_caption, _caller, _parmStr, _form);

    fieldList = new List(Types::Class);
    enum      = typeList.getEnumerator();

    while(enum.moveNext())
    {
      fieldList.addEnd(this.addField(enum.current()));
    }
}