简体   繁体   English

X ++或Dynamics AX中的.toString()变量是什么?

[英]What is the .toString() varient in X++ or Dynamics AX?

Is there something similar to the famous toString() method of C# in Axapta ? 是否有类似于Axapta中着名的C# toString()方法?

I try to run underlying code: 我尝试运行底层代码:

info(this.dataSource());

But it gives me this error message: "Argument 'txt' is incompatible with the required type." 但它给了我这个错误信息: “参数'txt'与所需的类型不兼容。”

The toString is available on all objects but usually not of much value: toString在所有对象上都可用,但通常没有多大价值:

info(this.dataSource().toString())

This gives this output: 这给出了这个输出:

Class FormDataSource Address

Probably you knew that already! 可能你已经知道了! However the query datasource does give something useful: 但是,查询数据源确实提供了一些有用的东西:

FormDataSource fds = this.dataSource();
;
info(fds.query().dataSourceTable(tableNum(Address)).toString());

gives the corresponding SQL query: 给出相应的SQL查询:

SELECT FIRSTFAST * FROM Address

如果您只是在寻找dataSource的名称,则可以执行以下操作:

info(this.dataSource().name());

I just want to add that I often use strFmt . 我只想补充说我经常使用strFmt

Counter c = 25;
int id = 3;
;
info(strfmt("Record number %1, id = %2", c, a)); //Record number 25, id = 3 

It is similar to String.Format() in C#. 它类似于C#中的String.Format() You can see more details here . 你可以在这里看到更多细节。

Unfortunately not, but there are a number of "...2Str()" methods for converting base data types to string, for example; 不幸的是,但是有很多“... 2Str()”方法用于将基本数据类型转换为字符串,例如;

int2Str() http://technet.microsoft.com/en-us/library/aa851371(v=ax.50).aspx int2Str() http://technet.microsoft.com/en-us/library/aa851371 int2Str() .aspx

int642str() http://technet.microsoft.com/en-us/library/aa851371(v=ax.50).aspx int642str() http://technet.microsoft.com/en-us/library/aa851371 int642str() .aspx

date2str() http://msdn.microsoft.com/en-us/library/aa857241(v=ax.10).aspx date2str() http://msdn.microsoft.com/en-us/library/aa857241 date2str() .aspx

Plus others. 加上其他人。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM