zoukankan      html  css  js  c++  java
  • Created field method on datasource in AX Form

    with X++ Jobs Created field method on datasource in AX Form

    代码
    static void Jimmy_CreateFieldMethodOnDataSource(Args _args)
    {
    TreeNode tn1,tnAddr, methodsNode;
    MemberFunction memberFunction;
    str source;
    System.Exception clrException;
    ;
    try
    {
    tn1
    = infolog.findNode(
    "\\Forms\\Address\\Data Sources\\Address\\Fields\\AddrRecId");

    tnAddr
    = infolog.findNode( "\\Forms\\Address" );
    methodsNode
    = tn1.AOTfindChild( 'Methods' );
    methodsNode.AOTadd(
    'lookup');
    memberFunction
    = methodsNode.AOTfindChild( 'lookup' );
    source
    = @"public void lookup(FormControl _formControl, str _filterStr)
    {
    super(_formControl, _filterStr);
    }
    " ;
    memberFunction.AOTsetSource(source,
    false);//true is Static method
    memberFunction.AOTsave();
    methodsNode.AOTsave();
    tnAddr.AOTcompile();
    }
    catch( Exception::Error)
    {
    throw exceptionTextFallThrough();
    }
    catch( Exception::CLRError)
    {
    clrException
    = CLRInterop::getLastException();
    if (clrException != null)
    {
    clrException
    = clrException.get_InnerException();
    if (clrException != null)
    {
    error(clrException.get_Message());
    }
    }
    }
    info(
    "Created method successful!" + methodsNode.treeNodePath());
    }
    /*
    Thanks for Max Belugin's comments,
    it is really good to use Verbatim String as well.
    The reason why I use escape characters here is
    because this line of code is copied from standard Axapta application :)
    */

  • 相关阅读:
    bzoj 1057: [ZJOI2007]棋盘制作
    【NOIP2012】开车旅行
    bzoj 2326: [HNOI2011]数学作业
    一本通1527欧拉回路
    一本通1530 Ant Trip
    一本通1528单词游戏
    luogu1856
    CF1045G
    10.18模拟赛
    10.16模拟赛
  • 原文地址:https://www.cnblogs.com/Fandyx/p/1750732.html
Copyright © 2011-2022 走看看