Notatka
Dostęp do tej strony wymaga autoryzacji. Może spróbować zalogować się lub zmienić katalogi.
Dostęp do tej strony wymaga autoryzacji. Możesz spróbować zmienić katalogi.
Note
Grupy zainteresowań społeczności zostały teraz przeniesione z usługi Yammer do aplikacji Microsoft Viva Engage. Aby dołączyć do społeczności Viva Engage i wziąć udział w najnowszych dyskusjach, wypełnij formularz Żądanie dostępu do aplikacji Finance and Operations Viva Engage Community i wybierz społeczność, którą chcesz dołączyć.
W tym artykule opisano funkcje środowiska uruchomieniowego odbicia.
classIdGet
Pobiera identyfikator liczbowy (identyfikator klasy) klasy, do którego należy zainicjowany obiekt.
int classIdGet(class object)
Parametry
| Parametr | Opis |
|---|---|
| obiekt | Obiekt, dla który ma uzyskać identyfikator klasy. |
Wartość zwracana
Identyfikator klasy określonego obiektu.
Example
static void classIdGetExample(Args _args)
{
int i;
WorkTimeCheck w;
i = classIdGet(w);
print "Class ID for object is " + int2Str(i);
}
dimOf
Pobiera liczbę elementów indeksu przydzielonych w tablicy X++.
int dimOf(anytype object)
Parametry
| Parametr | Opis |
|---|---|
| obiekt | Tablica określająca rozmiar wymiaru. |
Wartość zwracana
Jeśli wartość parametru obiektu jest tablicą, liczba elementów w tablicy; w przeciwnym razie 0 (zero).
Uwagi
Funkcja dimOf jest przeznaczona dla tablic X++, które są deklarowane jako następujące typy pierwotne X++:
- wartość logiczna
- data
- liczba całkowita
- int64
- real
- utcDateTime
Przykładem jest int iAmounts[6];. Tablice wartości wyliczania i rozszerzone typy danych są również obsługiwane, jeśli ostatecznie są oparte na jednym z poprzednich typów danych pierwotnych (takich jak int). Funkcja dimOf nie akceptuje tablic wszystkich typów pierwotnych X++. Oto typy tablic, których funkcja dimOf nie akceptuje:
- Str
- kontener
- anytype
- Tablice obiektów klas
- Wystąpienia klasy Array
Example
static void JobDimOfArrays(Args _args)
{
int iAmounts[20], iCounts[];
ABCModel enumAbcModel[22]; // Enum
ABCModelType exdtAbcModelType[24]; // Extended data type
anytype anyThings[26];
str sNames[28];
Array myArrayObj; // Class
info("Start of job.");
info("--(Next, normal int array, dimOf() accepts it.)");
info(int2Str(dimOf(iAmounts)));
info("--(Next, normal enum array, dimOf() accepts it.)");
info(int2Str(dimOf(enumAbcModel)));
info("--(Next, normal extended data type array (based on enum), dimOf() accepts it.)");
info(int2Str(dimOf(exdtAbcModelType)));
info("--(Next, dynamic int array, dimension not yet set.)");
info(int2Str(dimOf(iCounts)));
info("--(Next, dynamic int array, after dimension established.)");
iCounts[13] = 13;
info(int2Str(dimOf(iCounts)));
info(" == == == == == (Next, array types that dimOf() does not support.)");
info("--(Next, normal anytype array, dimOf() always returns 0.)");
info(int2Str(dimOf(anyThings)));
info("--(Next, an instance of class X++ Array, dimOf() always returns 0.)");
myArrayObj = new Array(Types::Integer);
myArrayObj.value(1,501);
info(int2Str(dimOf(myArrayObj)));
info("--(Next, the lastIndex method provides size information about Array instances.)");
info(int2Str(myArrayObj.lastIndex()));
info("--(Next, normal str array, dimOf() does not accept it, job is halted.)");
info(int2Str(dimOf(sNames)));
info("End of job.");
}
/************ Actual Infolog output
Message (11:10:06 am)
Start of job.
--(Next, normal int array, dimOf() accepts it.)
20
--(Next, normal enum array, dimOf() accepts it.)
22
--(Next, normal extended data type array (based on enum), dimOf() accepts it.)
24
--(Next, dynamic int array, dimension not yet set.)
0
--(Next, dynamic int array, after dimension established.)
16
== == == == == (Next, array types that dimOf() does not support.)
--(Next, normal anytype array, dimOf() always returns 0.)
0
--(Next, an instance of class X++ Array, dimOf() always returns 0.)
0
--(Next, the lastIndex method provides size information about Array instances.)
1
--(Next, normal str array, dimOf() does not accept it, job is halted.)
Error executing code: Illegal operation on this type of array. (C)JobsJobDimOfArrays - line 41
************/
/*********** Pop-up error dialog box
"Internal error number 25 in script."
This error is caused by the code line...
info(int2Str(dimOf(iCounts)));
...before iCounts was assigned at any index.
***********/
fieldId2Name
Pobiera ciąg reprezentujący nazwę pola określonego przy użyciu numeru identyfikatora tabeli i numeru identyfikatora pola.
str fieldId2Name(int tableid, int fieldid)
Parametry
| Parametr | Opis |
|---|---|
| tableid | Identyfikator tabeli. Nuta: Użyj funkcji tableName2Id , aby określić identyfikator tabeli. |
| fieldid | Identyfikator pola. |
Wartość zwracana
Nazwa pola.
Uwagi
Aby zwrócić drukowalną wersję nazwy pola, użyj funkcji fieldId2PName .
Example
Poniższy przykład ustawia wartość fn na nazwę pola w tabeli Customer (CustGroup), która ma identyfikator pola 7.
static void fieldId2NameExample(Args _arg)
{
str fn;
fn = fieldId2Name(tableName2Id("Customer"),7);
}
fieldId2PName
Pobiera drukowalną nazwę pola określonego przy użyciu numeru identyfikatora tabeli i numeru identyfikatora pola.
str fieldId2PName(int tableid, int fieldid)
Parametry
| Parametr | Opis |
|---|---|
| tableid | Identyfikator tabeli. Nuta: Użyj funkcji tableName2Id , aby określić identyfikator tabeli. |
| fieldid | Identyfikator pola. Nuta: Użyj funkcji fieldName2Id , aby określić identyfikator pola. |
Wartość zwracana
Nazwa pola.
Example
static void fieldId2PNameExample(Args _arg)
{
str name;
tableid _tableId;
fieldid _fieldid;
_tableId = tableName2Id("Address");
_fieldId = fieldName2Id(_tableId, "Name");
name = fieldId2PName(_tableId, _fieldid);
print name;
}
fieldName2Id
Pobiera identyfikator pola pola określonego przez Użytkownika przy użyciu numeru identyfikatora tabeli i numeru identyfikatora pola.
int fieldName2Id(int tableid, str fieldname)
Parametry
| Parametr | Opis |
|---|---|
| tableid | Identyfikator tabeli. Nuta: Użyj funkcji tableName2Id , aby określić identyfikator tabeli. |
| nazwa pola | Nazwa pola. |
Wartość zwracana
Identyfikator pola określonego przez parametry tableid i fieldname .
Example
static void fieldName2IdExample(Args _arg)
{
int id;
id = fieldName2Id(tableName2Id("Address"), "Name");
// Returns 6. Name is the 6th field in the Address table.
print id;
}
indexId2Name
Pobiera nazwę indeksu.
str indexId2Name(int tableid, int indexid)
Parametry
| Parametr | Opis |
|---|---|
| tableid | Identyfikator tabeli, do którego należy indeks. |
| indexid | Identyfikator indeksu. |
Wartość zwracana
Nazwa indeksu.
Example
static void indexId2NameExample(Args _arg)
{
str s;
tableid id;
indexid idx;
id = tableName2Id("Address");
idx = indexName2Id(id, "AddrIdx");
s = indexId2Name(id, idx);
print "The result of calling indexId2Name is " + s;
}
indexName2Id
Pobiera identyfikator indeksu.
int indexName2Id(int tableid, str indexname)
Parametry
| Parametr | Opis |
|---|---|
| tableid | Identyfikator tabeli, do którego należy indeks. |
| nazwa indeksu | Nazwa indeksu. |
Wartość zwracana
Identyfikator indeksu.
Example
static void indexName2IdExample(Args _arg)
{
indexid idx;
tableid id;
id = tableName2Id("Address");
idx = indexName2Id(id, "AddrIdx");
print "Index ID for index name AddrIdx of table Address is " + int2Str(idx);
}
tableId2Name
Pobiera ciąg zawierający nazwę tabeli.
str tableId2Name(int _tableid)
Parametry
| Parametr | Opis |
|---|---|
| _tableid | Identyfikator tabeli. |
Wartość zwracana
Nazwa tabeli.
Example
static void tableId2NameExample(Args _arg)
{
str s;
tableid id;
// Get the ID for table name Address.
id = tableName2Id("Address");
print "ID for table name Address is " + int2Str(id);
// Get the name from the table ID.
s = tableId2Name(id);
print "Name for table ID " + int2Str(id) + " is " + s;
// Get the printable name from the table ID.
s = tableId2PName(id);
print "Printable name for table ID " + int2Str(id) + " is " + s;
}
tableId2PName
Pobiera ciąg zawierający nazwę drukowalną (etykietę) tabeli.
str tableId2PName(int _fieldid)
Parametry
| Parametr | Opis |
|---|---|
| _fieldid | Identyfikator tabeli. |
Wartość zwracana
Etykieta tabeli.
Example
static void tableId2NameExample(Args _arg)
{
str s;
tableid id;
// Get the ID for table name Address.
id = tableName2Id("Address");
print "ID for table name Address is " + int2Str(id);
// Get the name from the table ID.
s = tableId2Name(id);
print "Name for table ID " + int2Str(id) + " is " + s;
// Get the printable name from the table ID.
s = tableId2PName(id);
print "Printable name for table ID " + int2Str(id) + " is " + s;
}
tableName2Id
Pobiera identyfikator tabeli.
int tableName2Id(str _name)
Parametry
| Parametr | Opis |
|---|---|
| _nazwa | Nazwa tabeli. |
Wartość zwracana
Identyfikator tabeli.
Example
static void tableName2IdExample(Args _arg)
{
str s;
tableid id;
// Get the ID for the Address table name.
id = tableName2Id("Address");
print "ID for the Address table name is " + int2Str(id);
// Get the name from the table ID.
s = tableId2Name(id);
print "Name for table ID " + int2Str(id) + " is " + s;
// Get the printable name from the table ID.
s = tableId2PName(id);
print "Printable name for table ID " + int2Str(id) + " is " + s;
}
typeOf
Pobiera typ elementu.
enum typeOf(anytype _object)
Parametry
| Parametr | Opis |
|---|---|
| _sprzeciwiać się | Element, dla który ma zwrócić typ. |
Wartość zwracana
Typ wartość wyliczenia systemu.
Example
Poniższy przykład sprawdza, czy pierwszy element w kontenerze c jest innym kontenerem zawierającym pojedynczą liczbę całkowitą.
if(typeof(conpeek(c, 1)) != Types::Container ||
conlen(conpeek(c, 1)) != 1 ||
typeof(conpeek(conpeek(c, 1), 1)) != Types::Integer)
{
// More code.
}