Receive Parameter in C# Thursday, Aug 2 2012 

In real software industry, sometimes we need to cooperate with another vendor to improve our product. In this case, I found a case that I need to send a parameter to my vendor application. My application is built under VB .net, while my vendor application is built under C# .Net. So what I did was.

In my VB .Net application, I put below code to call my vendor application. I put the executable file location under settings.

argument = “Servername|DBName|UserID|Password”

System.Diagnostics.Process.Start(My.Settings.exeLoc, argument.Trim())

Then in my vendor application, they need to put this code in form_load event and need to create a method to parse parameter based on delimitier “|” (let’s say if you’d like to send more then 1 parameter).

private void Form1_Load(object sender, EventArgs e)
{
   string[] args = Environment.GetCommandLineArgs();
   string param=””;

   // The first commandline argument is always the executable path itself.
   if (args.Length > 1)
   {

     for (int i = 1; i < args.Length;i++ )
     {
         param += args[i];
     }

     this.parse(param); 
   }
}

Have a nice try.

Modify Styles in Office 2007 Sunday, Apr 19 2009 

I was really unfamiliar with office 2007 because some of menu look disappear. One of it is how to modify styles, finally I’ve found it by pressing Ctrl+Shift+S ;)

Compare Date in Query method (AX 2009) Tuesday, Mar 17 2009 

Quite stuck in finding how to compare date in query method, but finally I found it. I need to convert it into strXpp so that the date convertion will convert correctly. Here is the example code:

……..
……..
queryRange = SysQuery::findOrCreateRange(qbsInventBatch, fieldnum(InventBatch,expDate));
queryRange.value(strfmt(‘(expDate > %1)’, Date2StrXpp(today())));

……
……

My Smart Speed Test Saturday, Feb 7 2009 

huuum, lama mau test speed dari Smart EVDO saya, di rumah saya (karang tengah), saya dapat 4 sinyal EVDO yang artinya full sinyal :) dan Alhamdulillah speed yang saya dapet tinggi juga :)

Get Standard Information in AX Monday, Jan 19 2009 

What I mean by standard function is, how to get logon user Id, default date or default datetime. I found it little bit hard, so that I’ll post it to make me easier to search

/*get the default user Id*/

curuserid()

/*get the default date */

today()

/*get the default date time*/

utcdatetime utc4, utcNow;

    ;

    utc4 = DateTimeUtil::utcNow();

    utcNow = DateTimeUtil ::applyTimeZoneOffset

        ( utc4,

        Timezone::GMTPLUS0700_BANGKOK_HANOI_JAKARTA

        );

Select query by using connection class Monday, Jan 19 2009 

query in standard Axapta is really limited because I can’t define distinct. Here is the code to define it, but as a note, you need to define it as a server run object.

public client server static void GetBatchListed( itemId _ItemId)

{

    Connection  conn;

    Statement   stmt;

    ResultSet   R;

    SqlStatementExecutePermission perm;

    str         sql;

    TSWrkInventBatch    TSWrkInventBatch;

    ;


    conn = new connection();

    stmt = conn.createStatement();


    sql = “select * from InventBatch IB inner join (“;

    sql += “select distinct c.InventBatchId from Inventsum a inner join InventDim b “;

    sql += “on a.Inventdimid = b.inventdimid “;

    sql += “inner join InventBatch c on b.InventBatchId = c.InventBatchId “;

    sql += “where a.ItemId = %1 and “;

    sql += “c.inventBatchId <> ”) as TBJoin on IB.InventBatchId = TBJoin.InventBatchId”;



    perm = new SqlStatementExecutePermission(strfmt(sql,_ItemId));

    perm.assert();

    R = Stmt.executeQuery(sql);


    while (R.next())

    {

        info( R.getString(fieldnum(InventBatch, InventBatchId)));

    }

}

Next Page »

Follow

Get every new post delivered to your Inbox.