AX 系统函数备忘(随时更新)

 

1:直接调用函数

       str 24 ComName;

       ;

       ComName=appl.company().ext();//当前公司ID

       curUserid();//当前用户iD

       systemDateget();//当前时间

       Time2Str(timenow(),1,2);//时间转换函数

       curuserid()//当前用户

 

2,使用Session对象

       session xSession;

       ;

       xSession=new session();

       print xsession.userId();pause;

       print xsession.interfaceLanguage();pause;

 

3,使用XInfo对象

static void currentConfiguartion(Args _args)

{

       AOSSessionInfo info = new AOSSessionInfo();

       SqlSystem SqlSystem = new SqlSystem();

       ;

       print xinfo::componentName();

       print xinfo::configuration();

       print xinfo::dbName();

       print xinfo::licenseName();

       print xinfo::releaseVersion();

       print info.clientMode();

       print SqlSystem.loginConnectString();

       print xinfo::directory(directorytype::Appl);

       print xinfo::directory(directorytype::DB);//....

 

       pause;

 

}

4,得到数据库信息: 我们可以使用类SqlSystem得到数据库的信息,

static void Job52(Args _args)

{

    sqlsystem sql;

    ;

    sql=new sqlsystem();

    print sql.databaseName();

    print sql.databaseId();

    print sql.loginServer();

    print sql.loginDatabase();

    print sql.loginName();

    pause;

}

 

5,取余,取整,取小数

static void job1 (Args   args)
{

real i,j;

  ;

  i=10;

  j=3;

  print trunc(i/j);              //取整

  print frac(i/j);                //小数

  print i-j*trunc(i/j);        //取余

  pause;

}

 

6, 判断文件访问权限

 

private void checkFileAccess(Filename _filename)

{

    #WinAPI

 

    FilePath            filePath = conpeek(fileNameSplit(_filename), 1);

    Filename            filename = 'AxaptaTestFile';

    str                 fileExt  = '.Axapta';

 

    Filename            testFilename;

    int                 handle;

 

    Counter             counter;

 

    Filename getFileName()

    {

        ;

        counter ++;

        return filePath + filename + strRFix(int2str(counter), 3, '0') + fileExt;

    }

 

    do

    {

        testFilename = getFileName();

    }

    while (WinAPI::fileExists(testFilename));

 

    handle = WinAPI::createFile(testFilename, #CREATE_NEW, #CREATE_ALWAYS);

 

    if (handle == -1)

    {

        throw error("@SYS97423");

    }

 

    WinAPI::closeHandle(handle);

    WinAPI::deleteFile(testFilename);

}

转载于:https://www.cnblogs.com/muskteer/archive/2008/06/02/1212321.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值