注释
社区兴趣团体现已从 Yammer 迁移到Microsoft Viva Engage。 若要加入 Viva Engage 社区并参与最新讨论,请填写 “请求访问财务和运营 Viva Engage 社区 ”表单,然后选择要加入的社区。
本文列出了编译时函数并介绍了其语法、参数和返回值。
概述
编译时函数在编译 X++ 代码期间提前执行。 应尽可能在 X++ 代码中使用它们,使代码能够复原到对应用程序资源管理器中存储的元数据的更改。 编译时函数的输入值由编译器验证。 如果未找到输入值以匹配应用程序资源管理器中的任何现有对象,编译器将发出错误。 这些函数的输入必须是文本,因为编译器无法确定变量在运行时包含的值。 编译时函数是元数据断言函数。 它采用的参数表示应用程序资源管理器中的实体,并在编译时验证参数。 它在运行时不起作用。 属性是从 SysAttribute 类继承的类。 若要支持对窗体、报表、查询和菜单元数据的验证,请使用控件上的 AutoDeclaration 属性。 其中大多数函数检索有关应用程序资源管理器中项的元数据。 一些常见的编译时函数如下所示:
-
classNum– 检索类的 ID。 -
classStr– 在编译期间,验证该名称的类是否存在。 此方法优于在运行时稍后发现错误。 -
evalBuf– 计算 X++ 代码的输入字符串,然后将结果作为字符串返回。 -
literalStr– 在给定标签的字符串表示形式(如字符串"@SYS12345")时检索标签 ID。 例如,myLabel.exists(literalStr("@SYS12345"));。
注释
无法从 .NET 程序调用 X++ 编译时间函数。
Functions
attributeStr
验证应用程序资源管理器中是否存在指定的属性类;如果不是,则会发生编译器错误。
Syntax
str classStr(class class)
参数
| 参数 | Description |
|---|---|
| 类 | 要验证的属性的名称。 |
返回值
属性的名称。
注解
这是一个编译时函数。 有关详细信息,请参阅概述。
Example
static void attributeStrExample(Args _args)
{
str s;
;
s = attributeStr(AifDocumentOperationAttribute);
print s;
pause;
}
classNum
检索指定类的 ID。
Syntax
int classNum(class class)
参数
| 参数 | Description |
|---|---|
| 类 | 要为其检索 ID 的类。 |
返回值
指定类的 ID。
注解
这是一个编译时函数。 有关详细信息,请参阅概述。
Example
static void classNumExample(Args _args)
{
int i;
;
i = classNum(Global);
print i;
pause;
}
classStr
检索类的名称作为字符串。
Syntax
str classStr(class class)
参数
| 参数 | Description |
|---|---|
| 类 | 要返回的类的名称。 |
返回值
类的名称。
注解
使用此函数而不是文本文本来检索包含类名的字符串。 如果该类不存在,则函数在编译时生成语法错误。 这是一个编译时函数。 有关详细信息,请参阅概述。
Example
static void clStrExample(Args _args)
{
str s;
;
s = classStr(Global);
print s;
pause;
}
configurationKeyNum
检索指定配置键的 ID。
Syntax
int configurationKeyNum(str keyname)
参数
| 参数 | Description |
|---|---|
| 键名 | 要为其返回 ID 的配置键。 |
返回值
指定配置键的 ID。
注解
这是一个编译时函数。 有关详细信息,请参阅概述。
Example
static void configurationKeyNum(Args _args)
{
int i;
;
i = configurationKeyNum(AIF);
print i;
pause;
}
configurationKeyStr
以字符串形式检索配置密钥的名称。
Syntax
str configurationKeyStr(str keyname)
参数
| 参数 | Description |
|---|---|
| 键名 | 配置密钥的名称。 |
返回值
配置密钥的名称。
注解
使用此函数而不是文本文本来检索包含配置键名称的字符串。 如果该键不存在,则函数在编译时生成语法错误。 这是一个编译时函数。 有关详细信息,请参阅概述。
Example
static void configurationKeyStrExample(Args _args)
{
str s;
;
s = configurationKeyStr(AIF);
print s;
pause;
}
dataEntityDataSourceStr
检索数据实体的数据源的名称。
Syntax
str dataEntityDataSourceStr(str dataEntity, str dataSource)
参数
| 参数 | Description |
|---|---|
| dataEntity | 数据实体的名称。 |
| dataSource | 数据源的名称。 |
返回值
数据源的名称。
注解
这是一个编译时函数。 有关详细信息,请参阅概述。
Example
无示例。
delegateStr
返回委托的名称。
Syntax
str delegateStr(str class, str instanceDelegate)
参数
| 参数 | Description |
|---|---|
| 类 | 类、表或窗体的名称。 |
| instanceDelegate | 实例委托的名称。 |
返回值
委托的名称。
注解
这是一个编译时函数。 有关详细信息,请参阅概述。
Example
无示例。
dimensionHierarchyLevelStr
返回维度层次结构级别的名称。
Syntax
str dimensionHierarchyLevelStr(str dimensionHierarchyLevel)
参数
| 参数 | Description |
|---|---|
| dimensionHierarchyLevel | 维度层次结构级别的名称。 |
返回值
维度层次结构级别的名称。
注解
这是一个编译时函数。 有关详细信息,请参阅概述。
Example
无示例。
dimensionHierarchyStr
返回维度层次结构的名称。
Syntax
str dimensionHierarchyStr(str dimensionHierarchy)
参数
| 参数 | Description |
|---|---|
| dimensionHierarchy | 维度层次结构的名称。 |
返回值
维度层次结构的名称。
注解
这是一个编译时函数。 有关详细信息,请参阅概述。
Example
无示例。
dimensionReferenceStr
返回维度引用的名称。
Syntax
str dimensionReferenceStr(str dimensionReference)
参数
| 参数 | Description |
|---|---|
| dimensionReference | 维度引用的名称。 |
返回值
维度引用的名称。
注解
这是一个编译时函数。 有关详细信息,请参阅概述。
Example
无示例。
dutyStr
检索表示指定安全职责名称的字符串。
Syntax
str dutyStr(str securityDuty)
参数
| 参数 | Description |
|---|---|
| securityDuty | 安全职责的名称。 |
返回值
字符串中安全职责的名称。
注解
这是一个编译时函数。 有关详细信息,请参阅概述。
Example
无示例。
enumCnt
检索指定枚举类型中的元素数。
Syntax
int enumCnt(enum enumtype)
参数
| 参数 | Description |
|---|---|
| enumtype | 枚举类型。 |
返回值
指定枚举类型中的元素数。
注解
这是一个编译时函数。 有关详细信息,请参阅概述。
Example
enumCnt(NoYes); //Returns 2, as the two elements are Yes and No.
enumLiteralStr
指示指定的字符串是否为指定枚举类型的元素。
Syntax
\enumLiteralStr(enum enum, string str)
参数
| 参数 | Description |
|---|---|
| 枚举 | 要从中检索指定值的枚举类型。 |
返回值
如果找到指定的字符串, 则为 str 参数的值;否则为编译错误。
注解
这是一个编译时函数。 有关详细信息,请参阅概述。
Example
static void getEnumValueAsString()
{
str i;
i = enumLiteralStr(ABCEnum, "valueInABCEnum");
print i;
pause;
}
enumNum
检索指定枚举类型的 ID。
Syntax
int enumNum(enum enum)
参数
| 参数 | Description |
|---|---|
| 枚举 | 要为其返回 ID 的枚举。 |
返回值
指定枚举类型的 ID。
注解
这是一个编译时函数。 有关详细信息,请参阅概述。
Example
static void enumNum(Args _args)
{
int i;
;
i = enumNum(ABC);
print i;
pause;
}
enumStr
检索作为字符串的枚举的名称。
Syntax
str enumStr(enum enum)
参数
| 参数 | Description |
|---|---|
| 枚举 | 枚举的名称。 |
返回值
枚举的名称。
注解
这是一个编译时函数。 有关详细信息,请参阅概述。
Example
static void enumStrExample(Args _args)
{
str s;
;
s = enumStr(ABC);
print s;
pause;
}
extendedTypeNum
检索指定扩展数据类型的 ID。
Syntax
int extendedTypeNum(int str)
参数
| 参数 | Description |
|---|---|
| str | 要为其返回 ID 的扩展数据类型。 |
返回值
指定的扩展数据类型的 ID。
注解
这是一个编译时函数。 有关详细信息,请参阅概述。
Example
static void EDTNum(Args _args)
{
int i;
str s;
;
i = extendedTypeNum(AccountName);
s = extendedTypeStr(AccountName);
print int2Str(i);
print s;
pause;
}
extendedTypeStr
检索扩展数据类型的名称作为字符串。
Syntax
str extendedTypeStr(int str)
参数
| 参数 | Description |
|---|---|
| str | 扩展数据类型的名称。 |
返回值
扩展数据类型的名称。
注解
使用此函数而不是文本文本可返回包含扩展数据类型名称的字符串。 如果数据类型不存在, 则 extendedTypeStr 函数在编译时生成语法错误。 这是一个编译时函数。 有关详细信息,请参阅概述。
Example
static void EDTStr(Args _args)
{
int i;
str s;
;
i = extendedTypeNum(AccountName);
s = extendedTypeStr(AccountName);
print int2Str(i);
print s;
pause;
}
fieldNum
返回指定字段的 ID 号。
Syntax
int fieldNum(str tableName, str fieldName)
参数
| 参数 | Description |
|---|---|
| tableName | 表的名称。 |
| 字段名称 | 字段的名称。 |
返回值
指定字段的 ID。
注解
这是一个编译时函数。 有关详细信息,请参阅概述。
Example
以下示例打印 CustTable 表中的 CashDisc 字段数。
static void fieldNumExample(Args _args)
{
int myInt;
;
myInt = fieldNum(CustTable, CashDisc);
Global::info(strfmt("CashDisc has a field ID of %1 in the CustTable table.", myInt));
}
/****Infolog Display
Message (10:40:00 am)
CashDisc has a field ID of 10 in the CustTable table.
****/
fieldPName
检索指定字段的标签。
Syntax
str fieldPName(str tableid, str fieldid)
参数
| 参数 | Description |
|---|---|
| tableid | 包含指定字段的表。 |
| fieldid | 要转换的字段。 |
返回值
字段的标签。
注解
这是一个编译时函数。 有关详细信息,请参阅概述。
Example
以下示例打印 CashDisc 字段的标签。
static void fieldPNameExample(Args _arg)
{
str myText;
;
myText = fieldPName(CustTable, CashDisc);
Global::info(strfmt("%1 is the label of the CashDisc field.", myText));
}
/****Infolog Display
Message (02:00:57 pm)
Cash discount is the label of the CashDisc field.
****/
fieldStr
检索指定字段的字段名称。
Syntax
str fieldStr(str tableid, str fieldid)
参数
| 参数 | Description |
|---|---|
| tableid | 包含字段的表。 |
| fieldid | 要转换的字段。 |
返回值
指定字段的字段名称。
注解
这是一个编译时函数。 有关详细信息,请参阅概述。
Example
以下示例将 CashDisc 字段的名称分配给 myText 变量。
static void fieldStrExample(Args _arg)
{
str myText;
;
myText = fieldStr(CustTable, CashDisc);
Global::info(strfmt("%1 is the specified field.", myText));
}
/****Infolog Display
Message (09:11:52 am)
CashDisc is the specified field.
****/
formControlStr
使 X++ 编译器检查窗体上是否存在控件,并将函数调用替换为有效控件名称的字符串。
Syntax
str formControlStr(formName, controlName)
参数
| 参数 | Description |
|---|---|
| formName | 窗体的名称,而不是引号。 |
| controlName | 窗体上的控件的名称,而不是引号。 |
返回值
包含应用程序资源管理器中显示的控件名称的字符串。
注解
如果编译器确定窗体上不存在控件,则会发出编译错误。 如果 X++ 代码使用包含引号的字符串来提供控件名称,则在运行时之前无法发现错误。 使用此函数,编译器可以在编译时发现早期的错误。 编译器执行的 formControlStr 等 X++ 函数称为编译时函数或编译时函数。 这就是为什么输入参数不是引号中的标准字符串。 编译时函数不会在编译器输出的 p 代码或其他可执行文件中表示。 这是一个编译时函数。 有关详细信息,请参阅概述。
Example
无示例。
formDataFieldStr
返回窗体中的数据字段的名称。
Syntax
str formDataFieldStr(str formName, str dataSource, str dataField)
参数
| 参数 | Description |
|---|---|
| formName | 窗体的名称。 |
| dataSource | 窗体的数据源。 |
| dataField | 数据源的数据字段。 |
返回值
窗体中的数据字段的名称。
注解
这是一个编译时函数。 有关详细信息,请参阅概述。
Example
str a = formDataFieldStr(FMVehicle, FMModelRate, RatePerDay);
formDataSourceStr
返回窗体中数据源的名称。
Syntax
str formDataSourceStr(str formName, str dataSource)
参数
| 参数 | Description |
|---|---|
| formName | 窗体的名称。 |
| dataSource | 窗体的数据源。 |
返回值
窗体中数据源的名称。
注解
这是一个编译时函数。 有关详细信息,请参阅概述。
Example
str b = formDataSourceStr(FMVehicle, FMModelRate);
formMethodStr
返回窗体方法的名称。
Syntax
str formMethodStr(str formName, str methodName)
参数
| 参数 | Description |
|---|---|
| formName | 窗体的名称。 |
| methodName | 窗体的方法。 |
返回值
窗体中方法的名称。
注解
这是一个编译时函数。 有关详细信息,请参阅概述。
Example
以下示例打印 showDialog 方法的名称。
str c = formMethodStr(Batch,showDialog);
formStr
检索窗体的名称。
Syntax
str formStr(str form)
参数
| 参数 | Description |
|---|---|
| 窗体 | 窗体的名称。 |
返回值
一个表示窗体名称的字符串。
注解
这是一个编译时函数。 有关详细信息,请参阅概述。
Example
以下示例打印 InventDim 窗体的名称。
static void formStrExample(Args _arg)
{
;
Global::info(formStr(InventDim));
}
/****Infolog Display
Message (11:04:39 am)
InventDim
****/
identifierStr
将指定的标识符转换为字符串。
Syntax
str identifierStr(str ident)
参数
| 参数 | Description |
|---|---|
| ident | 要转换的标识符。 |
返回值
一个表示指定标识符的字符串。
注解
如果使用 identifierStr 函数,将收到最佳做法警告。 之所以发生这种情况,是因为对 identifierStr 执行存在检查。 如果可用,请尝试使用更具体的编译时函数。 这是一个编译时函数。 有关详细信息, 概述。
Example
下面的代码示例将 myvar 变量名称分配给 thevar 变量。
static void indentifierStrExample(Args _args)
{
str myvar;
str thevar
;
thevar = "[" + identifierStr(myvar) + "]";
Global::info(strfmt(thevar));
}
/****Infolog Display
Message (09:19:49 am)
[myvar]
****/
indexNum
将指定的索引转换为数字。
Syntax
int indexNum(str tableid, str indexid)
参数
| 参数 | Description |
|---|---|
| tableid | 包含索引的表。 |
| indexid | 要转换的索引。 |
返回值
表示指定索引的索引号。
注解
这是一个编译时函数。 有关详细信息,请参阅概述。
Example
以下示例返回 Party 索引的索引值。
static void indexNumExample(Args _arg)
{
;
Global::info(strfmt("%1 is the index number of Party.", indexNum(CustTable, Party)));
}
/****Infolog Display
Message (11:28:03 am)
3 is the index number of Party.
****/
indexStr
将指定的索引转换为字符串。
Syntax
str indexStr(str tableid, str indexid)
参数
| 参数 | Description |
|---|---|
| tableid | 包含索引的表。 |
| indexid | 要转换的索引。 |
返回值
一个表示指定索引的字符串。
注解
这是一个编译时函数。 有关详细信息,请参阅概述。
Example
以下示例将 CashDisc 索引值分配给 myText 变量。
static void fieldStrExample(Args _arg)
{
str myText;
;
myText = fieldStr(CustTable, CashDisc);
Global::info(strfmt("%1 is the specified index.", myText));
}
/****Infolog Display
Message (09:11:52 am)
CashDisc is the specified index.
****/
licenseCodeNum
验证应用程序资源管理器中是否存在指定的许可证代码;如果不是,则会发生编译器错误。
Syntax
int licenseCodeNum(str codename)
参数
| 参数 | Description |
|---|---|
| codename | 要验证的许可证代码的名称。 |
返回值
指定许可证代码的数目。
注解
这是一个编译时函数。 有关详细信息,请参阅概述。
Example
static void licenseCodeNumExample(Args args)
{
int i;
;
i = licenseCodeNum(SysMorphX);
Global::info(strfmt("%1 is the license code number for SysMorphX.", i));
}
/****Infolog Display
Message (01:52:35 pm)
24 is the license code number for SysMorphX.
****/
licenseCodeStr
验证应用程序资源管理器中是否存在指定的许可证代码;如果不是,则会发生编译器错误。
Syntax
str licenseCodeStr(str codename)
参数
| 参数 | Description |
|---|---|
| codename | 要验证的许可证代码的名称。 |
返回值
指定许可证代码的名称。
注解
这是一个编译时函数。 有关详细信息,请参阅概述。
Example
static void licenseCodeStrExample(Args _arg)
{
str s;
;
s = licenseCodeStr(SysMorphX);
Global::info(strfmt("%1 is the license code string for SysMorphX.", s));
}
/****Infolog Display
Message (02:33:56 pm)
SysMorphX is the license code string for SysMorphX.
****/
literalStr
验证指定的字符串是否可以为文本字符串;如果不是,则会发生编译器错误。
Syntax
str literalStr(int str)
参数
| 参数 | Description |
|---|---|
| codename | 要验证的字符串。 |
返回值
文本字符串(如果有效)。
注解
这是一个编译时函数。 有关详细信息,请参阅概述。
Example
{
str s;
;
s = literalStr("This is a literal str");
print s;
pause;
}
maxDate
检索日期类型的变量允许的最大值。
Syntax
date maxDate()
返回值
日期 类型的变量允许的最大值,即 2154-12-31。
注解
这是一个编译时函数。 有关详细信息,请参阅概述。
Example
static void maxDateExample(Args _arg)
{
date maximumDate;
;
maximumDate = maxDate();
print maximumDate;
pause;
}
maxInt
检索可存储在 int 类型中的最大有符号值。
Syntax
int maxInt()
返回值
允许整数的最大值。
注解
任何其他整数将小于或等于返回的值。 这是一个编译时函数。 有关详细信息,请参阅概述。
Example
static void maxIntExample(Args _arg)
{
int i;
;
print "The maximum value for type int is " + int2Str(maxInt());
pause;
}
measurementStr
返回度量的名称。
Syntax
str measurementStr(str measurement)
参数
| 参数 | Description |
|---|---|
| 度量 | 度量的名称。 |
返回值
度量的名称。
注解
这是一个编译时函数。 有关详细信息,请参阅概述。
Example
无示例。
measureStr
返回度量值的名称。
Syntax
str measureStr(str measure)
参数
| 参数 | Description |
|---|---|
| 度量值 | 度量值的名称。 |
返回值
度量值的名称。
注解
这是一个编译时函数。 有关详细信息,请参阅概述。
Example
无示例。
menuItemActionStr
验证应用程序对象树中是否存在指定的菜单项作(应用程序资源管理器):如果没有,则会发生编译器错误。
Syntax
str menuItemActionStr(class menuitem)
参数
| 参数 | Description |
|---|---|
| codename | 要验证的菜单项作的名称。 |
返回值
菜单项作的名称(如果有效)。
注解
这是一个编译时函数。 有关详细信息,请参阅概述。
Example
{
str s1, s2, s3, s4;
;
s1 = menuItemActionStr(AssetCopy);
s2 = menuItemDisplayStr(Address);
s3 = menuItemOutputStr(AssetBarcode);
s4 = menuStr(Administration);
print "menuItemActionStr for AssetCopy is " + s1;
print "menuItemDisplayStr for Address is " + s2;
print "menuItemOutputStr for AssetBarcode is " + s3;
print "menuStr for Administration is " + s4;
pause;
}
menuItemDisplayStr
验证应用程序资源管理器中是否存在指定的菜单项显示;如果没有,则会发生编译器错误。
Syntax
str menuitemdisplaystr(class menuItem)
参数
| 参数 | Description |
|---|---|
| codename | 要验证的菜单项的名称。 |
返回值
指定的菜单项显示的名称(如果有效)。
注解
这是一个编译时函数。 有关详细信息,请参阅概述。
Example
{
str s1, s2, s3, s4;
;
s1 = menuItemActionStr(AssetCopy);
s2 = menuItemDisplayStr(Address);
s3 = menuItemOutputStr(AssetBarcode);
s4 = menuStr(Administration);
print "menuItemActionStr for AssetCopy is " + s1;
print "menuItemDisplayStr for Address is " + s2;
print "menuItemOutputStr for AssetBarcode is " + s3;
print "menuStr for Administration is " + s4;
pause;
}
menuItemOutputStr
验证应用程序资源管理器中是否存在指定的菜单项输出;如果不是,则会发生编译器错误。
Syntax
str menuItemOutputStr(class menuitem)
参数
| 参数 | Description |
|---|---|
| codename | 要验证的菜单项输出的名称。 |
返回值
指定的菜单项输出(如果有效)。
注解
这是一个编译时函数。 有关详细信息,请参阅概述。
Example
{
str s1, s2, s3, s4;
;
s1 = menuItemActionStr(AssetCopy);
s2 = menuItemDisplayStr(Address);
s3 = menuItemOutputStr(AssetBarcode);
s4 = menuStr(Administration);
print "menuItemActionStr for AssetCopy is " + s1;
print "menuItemDisplayStr for Address is " + s2;
print "menuItemOutputStr for AssetBarcode is " + s3;
print "menuStr for Administration is " + s4;
pause;
}
menuStr
验证应用程序资源管理器中是否存在指定的菜单;如果不是,则会发生编译器错误。
Syntax
str menuStr(class menu)
参数
| 参数 | Description |
|---|---|
| 菜单 | 要验证的菜单的名称。 |
返回值
指定的菜单项的名称(如果有效)。
注解
这是一个编译时函数。 有关详细信息,请参阅概述。
Example
{
str s1, s2, s3, s4;
;
s1 = menuItemActionStr(AssetCopy);
s2 = menuItemDisplayStr(Address);
s3 = menuItemOutputStr(AssetBarcode);
s4 = menuStr(Administration);
print "menuItemActionStr for AssetCopy is " + s1;
print "menuItemDisplayStr for Address is " + s2;
print "menuItemOutputStr for AssetBarcode is " + s3;
print "menuStr for Administration is " + s4;
pause;
}
methodStr
验证指定类中是否存在指定的方法;如果没有,则会发生编译器错误。
Syntax
str methodStr(class class, int method)
参数
| 参数 | Description |
|---|---|
| 类 | 类的名称。 |
| 方法 | 要验证的方法的名称。 |
返回值
指定方法的名称(如果有效)。
注解
这是一个编译时函数。 有关详细信息,请参阅概述。
Example
{
#define.timeout(50)
str s;
SysHelpInitTimeOut SysHelpInitTimeOut;
;
s = methodStr(SysHelpInitTimeOut, timeout);
print s;
pause;
}
minInt
检索可存储在 int 类型的最小有符号值。
Syntax
int minInt()
返回值
int 类型的最小值。
注解
任何其他整数值将大于或等于返回的值。 这是一个编译时函数。 有关详细信息,请参阅概述。
Example
static void minIntExample(Args _arg)
{
int i;
;
i = minInt();
print "minInt() is " + int2Str(i);
pause;
}
privilegeStr
返回特权的名称。
Syntax
str privilegeStr(str privilege)
参数
| 参数 | Description |
|---|---|
| 特权 | 要为其返回名称的特权。 |
返回值
权限的名称。
注解
这是一个编译时函数。 有关详细信息,请参阅概述。
Example
无示例。
queryDatasourceStr
使 X++ 编译器检查查询中是否存在数据源,并将函数调用替换为有效数据源名称的字符串。
Syntax
str queryDataSourceStr(queryName, dataSourceName)
参数
| 参数 | Description |
|---|---|
| queryName | 查询的名称,而不是引号。 |
| dataSourceName | 查询中数据源的名称,而不是引号。 |
返回值
一个字符串,其中包含在应用程序资源管理器中显示的数据源的名称。
注解
如果编译器确定数据源在查询上不存在,则会发出编译错误。 如果 X++ 代码使用包含引号的字符串来提供数据源名称,则在运行时之前无法发现错误。 使用此函数,编译器可以在编译时发现早期的错误。 编译器执行的 查询DataSourceStr 等 X++ 函数称为编译时函数或编译时函数。 这就是为什么输入参数不是引号中的标准字符串。 编译时函数不会在编译器输出的 p 代码或其他可执行文件中表示。 这是一个编译时函数。 有关详细信息,请参阅概述。
Example
无示例。
queryMethodStr
返回查询方法的名称。
Syntax
str queryMethodStr(str queryName, str methodName)
参数
| 参数 | Description |
|---|---|
| queryName | 查询的名称。 |
| methodName | 窗体的方法。 |
返回值
查询中方法的名称。
注解
这是一个编译时函数。 有关详细信息,请参阅概述。
Example
无示例。
queryStr
检索表示现有查询的字符串。
Syntax
str queryStr(str query)
参数
| 参数 | Description |
|---|---|
| 查询 | 要检索的查询。 |
返回值
查询的名称。
注解
这是一个编译时函数。 有关详细信息,请参阅概述。
Example
static void queryStrExample(Args _arg)
{
str myText;
;
myText = queryStr(AssetTable);
Global::info(strfmt("%1 is the name of the query.",myText));
}
/****Infolog Display
Message (09:45:16 am)
AssetTable is the name of the query.
****/
reportStr
检索表示指定报表名称的字符串。
Syntax
str reportStr(str report)
参数
| 参数 | Description |
|---|---|
| 报表 | 要为其返回名称的报表。 |
返回值
报表的名称。
注解
这是一个编译时函数。 有关详细信息,请参阅概述。
Example
以下示例将 AssetAddition 报表的名称分配给 MyTxt 变量。
static void reportStrExample(Args _args)
{
str MyTxt;
;
MyTxt = reportStr(AssetAddition);
Global::info(strfmt("%1 is the name of the report.", MyTxt));
}
/****Infolog Display.
Message (10:46:36 am)
AssetAddition is the name of the report.
****/
resourceStr
验证应用程序资源管理器中是否存在指定的资源;如果没有,则会发生编译器错误。
Syntax
str resourceStr(str resourcename)
参数
| 参数 | Description |
|---|---|
| resourcename | 要验证的资源的名称。 |
返回值
指定资源的名称(如果有效)。
注解
这是一个编译时函数。 有关详细信息,请参阅概述。
Example
{
print "Str for resource StyleSheet_Help_Axapta is "
+ resourceStr(StyleSheet_Help_Axapta);
pause;
}
roleStr
检索表示指定安全角色名称的字符串。
Syntax
str roleStr(str securityRole)
参数
| 参数 | Description |
|---|---|
| securityRole | 安全角色的名称。 |
返回值
字符串中安全角色的名称。
注解
这是一个编译时函数。 有关详细信息,请参阅概述。
Example
无示例。
ssrsReportStr
检索表示指定报表名称的字符串。 如果要指定应由报表控制器类运行的报表,请使用此函数。
Syntax
str ssrsReportStr(str report, str design)
参数
| 参数 | Description |
|---|---|
| 报表 | 要返回其名称的报表。 |
| 设计 | 与报表关联的设计的名称。 |
返回值
报表的名称。
注解
ssrsReportStr 函数分析传递给它的两个值,以验证它们是否属于有效的报表。 当菜单项指向控制器时,必须设置报表名称,以便控制器可以确定必须调用哪个报表设计组合。 使用 ssrsReportStr 函数可为报表和设计名称提供编译时验证的好处。 这是一个编译时函数。 有关详细信息,请参阅概述。
Example
public static void main(Args _args)
{
// Initializing the object for a controller class, in this case, the class named AssetListingController.
SrsReportRunController controller = new AssetListingController();
// Getting the properties of the called object (in this case AssetListing MenuItem)
controller.parmArgs(_args);
// Setting the Report name for the controller.
controller.parmReportName(ssrsReportStr(AssetListing, Report));
// Initiate the report execution.
controller.startOperation();
}
staticDelegateStr
返回静态委托的名称。
Syntax
str staticDelegateStr(str class, str delegate)
参数
| 参数 | Description |
|---|---|
| 类 | 类、表或窗体的名称。 |
| 委托 | 委托的名称。 |
返回值
委托的名称。
注解
这是一个编译时函数。 有关详细信息,请参阅概述。
Example
无示例。
staticMethodStr
验证指定类中是否存在指定的静态方法;如果没有,则会发生编译器错误。
Syntax
str staticMethodStr(class class, int method)
参数
| 参数 | Description |
|---|---|
| 类 | 类的名称。 |
| 方法 | 要验证的静态方法的名称。 |
返回值
静态方法的名称(如果有效)。
注解
这是一个编译时函数。 有关详细信息,请参阅概述。
Example
无示例。
tableCollectionStr
验证应用程序资源管理器中是否存在指定的表集合;如果没有,则会发生编译器错误。
Syntax
str tableCollectionStr(class tablecollection)
参数
| 参数 | Description |
|---|---|
| tablecollection | 要验证的表集合的名称。 |
返回值
指定表集合的名称(如果有效)。
注解
这是一个编译时函数。 有关详细信息,请参阅概述。
Example
无示例。
tableFieldGroupStr
检索字段组的名称作为字符串。
Syntax
str tableFieldGroupStr(str tableName, str fieldGroupName)
参数
| 参数 | Description |
|---|---|
| tableName | 包含字段组的表。 |
| fieldGroupName | 表中的字段组。 |
返回值
字段组的名称作为字符串。
注解
这是一个编译时函数。 有关详细信息,请参阅概述。
Example
以下示例将 编辑 字段组的名称检索为字符串。
static void tableFieldGroupStrExample(Args _arg)
{
;
Global::info(tableFieldGroupStr(AccountingDistribution, Editing));
}
/****Infolog Display
Message (03:14:54 pm)
Editing
****/
tableMethodStr
验证指定表中是否存在指定的方法;如果没有,则会发生编译器错误。
Syntax
str tableMethodStr(int table, int method)
参数
| 参数 | Description |
|---|---|
| 表 | 表的名称。 |
| 方法 | 要验证的方法的名称。 |
返回值
方法的名称(如果有效)。
注解
这是一个编译时函数。 有关详细信息,请参阅概述。
Example
无示例。
tableNum
检索指定表的表 ID。
Syntax
int tableNum(str table)
参数
| 参数 | Description |
|---|---|
| 表 | 要为其检索表 ID 的表。 |
返回值
指定表的表 ID。
注解
这是一个编译时函数。 有关详细信息,请参阅概述。
Example
以下示例将 tableID 变量设置为 77,这是 CustTable 表的 ID。
static void tableNumExample(Args _args)
{
int tableID;
;
tableID = tableNum(CustTable);
Global::info(strfmt("%1 is the table ID for the CustTable table.", tableID));
}
/****Infolog Display
Message (11:15:54 am)
77 is the table ID for the CustTable table.
****/
tablePName
检索包含指定表可打印名称的字符串。
Syntax
str tablePName(str table)
参数
| 参数 | Description |
|---|---|
| 表 | 要检索其可打印名称的表。 |
返回值
指定表的名称。
注解
这是一个编译时函数。 有关详细信息,请参阅概述。
Example
以下示例将 CustTable 表的标签分配给 MyText 变量。
static void tablePNameExample(Args _args)
{
str MyText;
;
MyText = tablePname(CustTable);
Global::info(strfmt("%1 is the label of the CustTable table.", MyText));
}
/**** Infolog Display.
Message (12:13:53 pm)
Customers is the label of the CustTable table.
****/
tableStaticMethodStr
验证指定表中是否存在指定的静态方法;如果没有,则会发生编译器错误。
Syntax
str tableStaticMethodStr(int table, int method)
参数
| 参数 | Description |
|---|---|
| 表 | 表的名称。 |
| 方法 | 要验证的静态方法的名称。 |
返回值
指定的静态方法的名称。
注解
这是一个编译时函数。 有关详细信息,请参阅概述。
Example
无示例。
tableStr
检索包含指定表的名称的字符串。
Syntax
str tableStr(str table)
参数
| 参数 | Description |
|---|---|
| 表 | 要为其检索字符串的表。 |
返回值
一个字符串值,该值包含指定表的名称。
注解
这是一个编译时函数。 有关详细信息,请参阅概述。
Example
以下示例将 CustTable 表的名称分配给 MyTxt 变量。
static void tableStrExample(Args _args)
{
str MyTxt;
;
MyTxt = tableStr(CustTable);
Global::info(strfmt("%1 is the str output of the input of CustTable.", MyTxt));
}
/**** Infolog Display.
Message (01:21:49 pm)
CustTable is the str output of the input of CustTable.
****/
tileStr
检索表示指定磁贴名称的字符串。
Syntax
str tileStr(str tile)
参数
| 参数 | Description |
|---|---|
| 图块 | 磁贴的名称。 |
返回值
字符串中磁贴的名称。
注解
这是一个编译时函数。 有关详细信息,请参阅概述。
Example
无示例。
varStr
检索包含指定变量名称的字符串。
Syntax
str varStr(str var)
参数
| 参数 | Description |
|---|---|
| var | 变量的名称。 |
返回值
一个包含指定变量名称的字符串。
注解
这是一个编译时函数。 有关详细信息,请参阅概述。
Example
static void varStrExample(Args _arg)
{
str myString;
anytype myVariable;
;
myString = varStr(myVariable);
Global::info(strfmt("%1 is the variable name.", myString));
}
/****Infolog Display.
Message (02:26:56 pm)
myVariable is the variable name.
****/
webActionItemStr
验证应用程序资源管理器中是否存在指定的 Web作项;如果没有,则会发生编译器错误。
Syntax
str webActionItemStr(class webactionitem)
参数
| 参数 | Description |
|---|---|
| webactionitem | 要验证的 Web作项的名称。 |
返回值
指定的 Web作项的名称(如果有效)。
注解
这是一个编译时函数。 有关详细信息,请参阅概述。
Example
{
str s;
;
s = webActionItemStr(EPFlushData);
print "webactionitem str is " + s;
pause;
}
webDisplayContentItemStr
验证应用程序资源管理器中是否存在指定的 Web 显示内容项;如果没有,则会发生编译器错误。
Syntax
str webDisplayContentItemStr(class webdisplaycontentitem)
参数
| 参数 | Description |
|---|---|
| webdisplaycontentitem | 要验证的 Web 显示内容项的名称。 |
返回值
指定的 Web 显示内容项的名称(如果有效)。
注解
这是一个编译时函数。 有关详细信息,请参阅概述。
Example
{
str s;
;
s = webDisplayContentItemStr(EPAdmin);
print "string for webcontent display item EPAdmin is " + s;
pause;
}
webFormStr
验证应用程序资源管理器中是否存在指定的 Web 窗体;如果没有,则会发生编译器错误。
Syntax
str webFormStr(str name)
参数
| 参数 | Description |
|---|---|
| 姓名 | 要验证的 Web 窗体的名称。 |
返回值
指定 Web 窗体的名称(如果有效)。
注解
这是一个编译时函数。 有关详细信息,请参阅概述。
Example
{
str s;
;
s = webFormStr(EPAdmin);
print "String for web form EPAdmin is " + s;
pause;
}
webletItemStr
验证应用程序资源管理器中是否存在指定的 Weblet 项;如果没有,则会发生编译器错误。
Syntax
str webletItemStr(class webletitem)
参数
| 参数 | Description |
|---|---|
| webletitem | 要验证的 Weblet 项的名称。 |
返回值
指定 Weblet 项的名称(如果有效)。
注解
这是一个编译时函数。 有关详细信息,请参阅概述。
Example
{
str s;
;
s = webletItemStr(WebFormWeblet);
print "String for WebFormWeblet is " + s;
pause;
}
webMenuStr
验证应用程序资源管理器中是否存在指定的 Web 菜单;如果没有,则会发生编译器错误。
Syntax
str webMenuStr(str name)
参数
| 参数 | Description |
|---|---|
| 姓名 | 要验证的 Web 菜单的名称。 |
返回值
指定 Web 菜单的名称(如果有效)。
注解
这是一个编译时函数。 有关详细信息,请参阅概述。
Example
{
str s;
;
s = webMenuStr(ECPAdmin);
print "String for web menu ECPAdmin is " + s;
pause;
}
webOutputContentItemStr
验证应用程序资源管理器中是否存在指定的 Web 输出内容项;如果没有,则会发生编译器错误。
Syntax
str webOutputContentItemStr(class weboutputcontentitem)
参数
| 参数 | Description |
|---|---|
| weboutputcontentitem | 要验证的 Web 输出内容项的名称。 |
返回值
指定的 Web 输出内容项的名称(如果有效)。
注解
这是一个编译时函数。 有关详细信息,请参阅概述。
Example
{
str s;
;
s = webOutputContentItemStr(EPPriceList);
print "string for weboutput content item EPPriceList is " + s;
pause;
}
网页DefStr
验证应用程序资源管理器中是否存在指定的网页定义;如果没有,则会发生编译器错误。
Syntax
str webpageDefStr(str pagename)
参数
| 参数 | Description |
|---|---|
| pagename | 要验证的网页定义的名称。 |
返回值
指定网页定义的名称(如果有效)。
注解
这是一个编译时函数。 有关详细信息,请参阅概述。
Example
无示例。
webReportStr
验证应用程序资源管理器中是否存在指定的 Web 报表;如果没有,则会发生编译器错误。
Syntax
str webReportStr(str name)
参数
| 参数 | Description |
|---|---|
| 姓名 | 要验证的 Web 报表的名称。 |
返回值
指定 Web 报表的名称(如果有效)。
注解
这是一个编译时函数。 有关详细信息,请参阅概述。
Example
{
str s;
;
s = webReportStr(EPCSSSalesConfirm);
print "String for web report EPCSSalesConfirm is " + s;
pause;
}
websiteDefStr
验证应用程序资源管理器中是否存在指定的网站定义;如果没有,则会发生编译器错误。
Syntax
str websiteDefStr(str resourcename)
参数
| 参数 | Description |
|---|---|
| resourcename | 要验证的网站定义的名称。 |
返回值
指定网站定义的名称(如果有效)。
注解
这是一个编译时函数。 有关详细信息,请参阅概述。
Example
{
str s;
;
s = websiteDefStr(AxSiteDef_1033_xip);
print "string for web site definition AxSiteDef_1033_xip is " + s;
pause;
}
webSiteTempStr
验证应用程序资源管理器中是否存在指定的网站模板;如果没有,则会发生编译器错误。
Syntax
str websiteTempStr(str resourcename)
参数
| 参数 | Description |
|---|---|
| resourcename | 要验证的网站模板的名称。 |
返回值
指定网站模板的名称(如果有效)。
注解
这是一个编译时函数。 有关详细信息,请参阅概述。
Example
无示例。
webStaticFileStr
验证应用程序资源管理器中是否存在指定的 Web 静态文件;如果没有,则会发生编译器错误。
Syntax
str webStaticFileStr(str pagename)
参数
| 参数 | Description |
|---|---|
| pagename | 要验证的 Web 静态文件的名称。 |
返回值
指定的 Web 静态文件的名称(如果有效)。
注解
这是一个编译时函数。 有关详细信息,请参阅概述。
Example
{
str s;
;
s = webStaticFileStr(AXEP);
print "string for web static file AXEP is " + s;
pause;
}
webUrlItemStr
验证应用程序资源管理器中是否存在指定的 Web URL 项;如果没有,则会发生编译器错误。
Syntax
str webUrlItemStr(class weburlitem)
参数
| 参数 | Description |
|---|---|
| weburlitem | 要验证的 Web URL 项的名称。 |
返回值
指定的 Web URL 项的名称(如果有效)。
注解
这是一个编译时函数。 有关详细信息,请参阅概述。
Example
{
str s;
;
s = webUrlItemStr(EPAdmin);
print "string for web url item EPAdmin is " + s;
pause;
}
webWebPartStr
验证应用程序资源管理器中是否存在指定的 Web 部件;如果没有,则会发生编译器错误。
Syntax
str webWebpartStr(str resourcename)
参数
| 参数 | Description |
|---|---|
| resourcename | 要验证的 Web 部件的名称。 |
返回值
指定 Web 部件的名称(如果有效)。
注解
这是一个编译时函数。 有关详细信息,请参阅概述。
Example
{
str s;
;
s = webWebpartStr(AxWebParts_cab);
print "string for web part AxWebParts_cab is " + s;
pause;
}
workflowApprovalStr
检索应用程序对象树(应用程序资源管理器)中工作流审批的名称作为字符串。
Syntax
str workflowapprovalstr(approval approval)
参数
| 参数 | Description |
|---|---|
| 审批 | 工作流审批的应用程序资源管理器名称。 |
返回值
表示工作流审批的应用程序资源管理器名称的字符串。
注解
使用此函数而不是文本文本来检索包含工作流审批名称的字符串。 如果工作流审批不存在,则函数在编译时生成语法错误。 这是一个编译时函数。 有关详细信息,请参阅概述。
Example
下面的代码示例将变量 str s 设置为 MyWorkflowApproval ,这是应用程序资源管理器中工作流审批的名称。
static void MyWorkflowApprovalStrExample(Args _args)
{
str s;
;
s = workflowapprovalstr(MyWorkflowApproval);
print s;
pause;
}
workflowCategoryStr
检索应用程序对象树(应用程序资源管理器)中工作流类别的名称作为字符串。
Syntax
str workflowcategorystr(category category)
参数
| 参数 | Description |
|---|---|
| 分类 | 工作流类别的应用程序资源管理器名称。 |
返回值
表示工作流类别的应用程序资源管理器名称的字符串。
注解
使用此函数而不是文本文本来检索包含工作流类别名称的字符串。 如果工作流类别不存在,则函数在编译时生成语法错误。 这是一个编译时函数。 有关详细信息,请参阅概述。
Example
下面的代码示例将变量 str s 设置为 MyWorkflowCategory ,这是应用程序资源管理器中工作流类别的名称。
static void MyWorkflowCategoryStrExample(Args _args)
{
str s;
;
s = workflowcategorystr(MyWorkflowCategory);
print s;
pause;
}
workflowTaskStr
检索应用程序对象树(应用程序资源管理器)中工作流任务的名称作为字符串。
Syntax
str workflowtaskstr(task task)
参数
| 参数 | Description |
|---|---|
| 任务 | 工作流任务的应用程序资源管理器名称。 |
返回值
表示工作流任务的应用程序资源管理器名称的字符串。
注解
使用此函数而不是文本文本来检索包含工作流任务名称的字符串。 如果工作流任务不存在,则函数在编译时生成语法错误。 这是一个编译时函数。 有关详细信息,请参阅概述。
Example
下面的代码示例将变量 str s 设置为 MyWorkflowTask ,这是应用程序资源管理器中工作流任务的名称。
static void MyWorkflowTaskStrExample(Args _args)
{
str s;
;
s = workflowtaskstr(MyWorkflowTask);
print s;
pause;
}
workflowTypeStr
验证应用程序资源管理器中是否存在指定的工作流类型;如果没有,则会发生编译器错误。
Syntax
str workflowTypeStr(str workflow)
参数
| 参数 | Description |
|---|---|
| 工作流 | 要验证的工作流类型的名称。 |
返回值
工作流类型的名称。
注解
这是一个编译时函数。 有关详细信息,请参阅概述。
Example
static void workFlowTypeStrExample(Args _args)
{
str s;
;
s = workFlowTypeStr(BudgetAccountEntryType);
print s;
pause;
}