자주 쓰는 X++ 기본 내장 함수 정리
Dynamics AX 개발 언어인 X++ 에서 자주 사용되는 함수들입니다. 개발에 참고하세요.
* AX function
1. abs : 절대값 ex) abs(-100.0) -> 100.0
2. 정보없는 것들 : any2Date, any2Enum, ~2Guid, ~2Int, ~2Int64,
~2Read, ~2Str, ~
3. ascii2Ansi : Ansi code에서 문자로 변환(page437 이용)
ex1)-old pattern
AsciiIO io;
io = new AsciiIO('filename', "W");
io.write(ansi2Ascii("string"));
ex2)-new pattern
TextIO io;
io = new TextIO("filename","W",437);
io.write("string");
%ansi2Ascii 는 역방향임
4. char2Num : 특정자리 문자를 숫자로 변환(ascii코드별)
ex) char2Num("ABCDEFG", 3) => C값으로 67반환
5. classIdGet : 인스턴스화된 객체를 클래스 대한 ID값을 반환
= int classIdGet(class object)
ex)
static void classIdGetExample(Args _args)
{
int i;
WorkTimeCheck w;
;
i = classIdGet(w);
print "Class ID for object is " + int2Str(i);
pause;
}
6. classNum : 클래스에 대한 id값 반환
= int classNum(class class)
ex)
static void classNumExample(Args _args)
{
int i;
;
i = classNum(Global);
print i;
pause;
}
7. classStr : 클래스 이름을 스트링 형식으로 반환
= str classStr(class class)
ex)
static void clStrExample(Args _args)
{
str s;
;
s = classStr(Global);
print s;
pause;
}
8. configurationKeyNum : configuration 키값을 반환
= int configurationKeyNum(str keyname)
ex)
static void configurationKeyNum(Args _args)
{
int i;
;
i = configurationKeyNum(AIF);
print i;
pause;
}
9. conFind : container안에서 해당하는 속성들이 반응하거나 특성을 추적하는 메소드. 만약 결과물안에서 여러개의 특정값이 조회되면 이들의 구분은 콤마에 의해 나뉘어 지고, 정확한 순서대로 위치설정이 된다. 속성값들은 아무 타입이나 상관없음
= int conFind (container container, anytype element,... )
ex)
static void conFindExample(Args _args)
{
container c = ["item1", "item2", "item3"];
int i;
int j;
;
i = conFind(c, "item2");
j = conFind(c, "item4");
print "Position of 'item2' in container is " + int2Str(i);
print "Position of 'item4' in container is " + int2Str(j);
pause;
}
결과 :Position of 'item2' in container is 2
Position of 'item4' in container is 0
10. conIns : container안에 1개 이상의 구성자를 입력한다
= container conIns (container container, int start, anytype element,... )
ex)
static void conInsExample(Args _arg)
{
container c;
int i;
;
c = conIns(["item1", "item2"], 1);
for (i = 1 ; i <= conLen(c) ; i++)
{
// Prints the content of a container.
print conPeek(c, i);
}
pause;
}
11. conLen : container안의 속성값들의 개수를 반환함.
= int conLen(container container)
ex)
static void conLenExample(Args _arg)
{
container c;
int i;
;
c = conins(["item1", "item2"], 1);
for (i = 1 ; i <= conLen(c) ; i++)
{
print conPeek(c, i);
}
pause;
}
12. conNull : null container를 반환한다. container의 내용물을 확실하게 배치하기 위해 사용하는 메소드
= container conNull()
ex)
static void conNullExample(Args _arg)
{
container c = ["item1", "item2", "item3"];
;
print "Size of container is " + int2str(conLen(c));
// Set the container to null.
c = conNull();
print "Size of container after conNull() is " + int2Str(conLen(c));
pause;
}
13. conPeek : container로 부터 특정위치의 값을 반환한다.
= anytype conPeek(container container, int number)
ex)
static void conPeekExample(Args _arg)
{
str fileName;
container rows;
container cells;
int row;
int column;
CustAccount CUSTA;
HSA_AR_Van_Upload_Month uploadMonth;
HSA_AR_Car_SS SS;
;
fileName = strFileName.text();//미리 strFileName를 선언해서 그대로 사용할 수 있음
rows = HSA_ExcelUtils::readExcel(fileName, 25);//엑셀시트와 연동해서 해당되는 데이터를 그대로 들고 올 수 있음
for (row = 2; row <= conlen(rows);row++) { //엑셀의 2번째 열부터 데이터를 들고와서 조회를 할 수 있음
cells = conpeek(rows, row); //각 열의 필드별 데이터 세팅
CUSTA = conpeek(cells, 1);
uploadMonth.clear();
if(SS.CS_Serial != ""){
uploadMonth.AccountNum = conpeek(cells, 1); //해당열의 1번째 필드값을 반환
}else{
info("Invalid data : " + int2str(row) + "row");
}
}
}
14. conPoke : container 안에 있는 특정 속성을 1개 이상 변환할 수 있는 메소드
= container conPoke(container container, int start, anytype element, ...)
ex)
static void conPokeExample(Args _arg)
{
container c1 = ["item1", "item2", "item3"];
container c2;
int i;
void conPrint(container c)
{
for (i = 1 ; i <= conLen(c) ; i++)
{
print conPeek(c, i);
}
}
;
conPrint(c1);
c2 = conPoke(c1, 2, "PokedItem");
print "";
conPrint(c2);
pause;
}
15. corrFlagGet : 실수에 대해 수정된 표시문자(플래그)의 상태(표시 or clear)를 반환한다
= int corrFlagGet(real arg)
16. corrFlagSet : 실수에 대해 보정된 표시문자를 조정한다.
= real corrFlagSet(real real, int arg) => real: The flag to set or clear, arg : Sets or clears the flag. A non-zero value sets the flag.
17. cTerm : 목표치 산출을 위해 현재 투자 값으로 요구되는 기간을 계산한다. ()=>다시 봐야 할듯....
= real cTerm(real interest, real future_value, real current_value)
ex)
static void cTermExample(Args _arg)
{
real r;
;
r = cTerm(10.0, 500.00, 100.00);
print "The cTerm is " + num2Str(r, 2, 2, 1, 1);
pause;
}
ex2)
static void Job5(Args _args)
{
real r;
;
r = cTerm(10.0, 500.00, 100.00);
print "The cTerm is " + num2Str(r,0,10,1,0);
pause;
}//결과 값들은 소수점 몇자리까지 나옴
18. curExt : 현재 회사에 대한 명을 반환
= str curExt()
ex)
static void curExtExample(Args _arg)
{
str s;
;
// Sets s to the extension of the current company.
s = curExt();
print "Current extension is " + s;
pause;
}
19. curUserId : 현 사용자에 대한 userID를 반환한다.
= str curUserId()
ex)
static void curUserIdExample(Args _arg)
{
str s;
;
s = curUserId();
print "Current user ID is " + s;
pause;
}
20. date2Num : 1 January 1900 이래로 해당날짜를 일치하는 지나간 날짜의 일을 계산하여 반환한다.
= int date2Num(date _date)
ex)
static void date2NumExample(Args _arg)
{
date d = today();
int i;
;
i = date2Num(d);
print i;
pause;
}
21. date2Str : 날짜를 텍스트로 반환
= str date2Str(date date, int sequence, int day, int separator1, int month, int separator2, int year)
date - The date to be converted.
sequence - The sequence for the components of the date (day, month, year).
Day is shown by 1, month by 2, and year by 3. Possible sequences:
day, month, year
year, month, day
year, day, month
day - The format for the day component of the date.
Possible formats:
Can be expressed as one or two digits, as required
Always expressed as two digits
separator1 - The separator to use between the first two components of the date.
Possible values:
a " " (space)
a "." (period)
a "-" (hyphen)
a "/" (forward slash)
month - The format for the month.
Possible formats: Can be expressed as one or two digits, as required
Expressed as two digits
Expressed as three characters
Expressed by its entire name
separator2 - The separator to use between the last two elements of the date.
Possible values:
a " " (space)
a "." (period)
a "-" (hyphen)
a "/" (forward slash)
year - The format for the year.
Possible formats:
Expressed as two digits
Expressed as four digits
ex)
static void date2StrExample(Args _arg)
{
date d = today();
str s;
;
s = date2Str(d, 2, 2, -1, 2, -1, 2);
print "Today's date is " + s;//07-08-21
pause;
}
22. dayName : 날짜를 일주일의 요일별로 1~7사이값으로 보여준다.
= str dayName(int number)
ex)
static void dayNameExample(Args _arg)
{
str s;
;
s = dayName(01);
print "First day of the week's name is " + s;
pause;
}
23. dayOfMth : 날짜에 대해 한달중 날짜를 보여준다.
= int dayOfMth(date date)
ex)
static void dayOfMthExample(Args _arg)
{
date d = today();
int i;
;
i = dayOfMth(d);
print "Today's day of the month is " + int2Str(i);
pause;
}
24. dayOfWk : 날짜중에서 일주일 단위로 날짜를 보여준다.
= int dayOfWk(date date)
ex)
static void dayOfWkExample(Args _arg)
{
date d = today();
int i;
;
i = dayOfWk(d);
print "Today's day of the week is " + int2Str(i);
pause;
}
25. dayOfYr : 1월1일부터 지정된 날짜까지 일수를 계산한다.
= int dayOfYr(date _date)
ex)
static void dayOfYrExample(Args _arg)
{
date d = today();
int i;
;
i = dayOfYr(d);
print "Today's day of the year is " + int2Str(i);
pause;
}
ex2) 전체 조회 테스트
static void Job5(Args _args)
{
date d = today();
int i;
str s;
;
i = dayOfWk(d);
print "Today's day of the week is " + int2Str(i);
pause;
s = dayName(10);
print "First day of the week's name is " + s;
pause;
i = dayOfYr(d);
print "Today's day of the year is " + int2Str(i);
pause;
}
26. ddb : 속도가 붙은 자산의 가치하락(감가상각)을 계산한다
= real ddb(real price, real scrap, real life, int period)
price - The purchase price of the asset.
scrap - The residual value of the asset that has been written off.
life - The expected lifetime of the asset.
period - The period to calculate depreciation over.
ex)
// Returns the value 2400.
ddb(12000,2000,10,1);
// Returns the value 1536.
ddb(12000,2000,10,3);
27. decRound : 지정된 자리수대로 반올림이 되어야 한다.
= real decRound(real figure, int decimals)
ex)
// Returns the value 1234.66.
decRound(1234.6574,2);
// Returns the value 1235.
decRound(1234.6574,0);
// Returns the value 1200.
decRound(1234.6574,-2);
28. dg : 판매가격과 구매가격을 기초로 하여 차지하는 비율을 계산한다.
= real dg(real sale, real purchase)
ex)
// Returns the value 0.7.
dg(1000,300);
// Returns the value 0.45.
dg(20000, 11000);
29. dimOf : 순열안에서 속성의 자리값을 반환한다.
= int dimOf(anytype object)
ex)
static void dimOfExample(Args _arg)
{
Array a;
;
a = new Array(Types::Integer);
a.value(1, 42);
a.value(2, 666);
print "Dimension of array is " + int2Str(dimOf(a));
pause;
}
30. endMth : 지정된 달의 마지막 날자를 반환한다.
= date endMth(date date)
ex)
// Returns the date 29\02\1988 (leap year).
endMth(02\02\1988);
// Returns the date 28\02\1989.
endMth(02\02\1989);
31. enum2Str : enum을 스트링으로 변환
= str enum2Str(enum enum)
32. enumCnt : enum속성에서 해당되는 속성값을 반환
= int enumCnt(enum enumtype)
ex)
// Returns 2 (the two elements are Yes and No).
enumCnt(NoYes);
33. enumNum : enum에 대해 ID를 반환
= int enumNum(enum enum)
34. enumStr : enumeration을 스트링으로 반환한다.
= str enumStr(enum enum)
35. evalBuf : X++ code의 입력스트링에 대해 평가하고, 스트링을 결과값으로 반환한다.
= str evalBuf(str expressionString)
ex)
static void JobEvalBufDemo(Args _args)
{
ExecutePermission perm;
str strCodeToExecute = "2 + 5";
str strResult;
;
perm = new ExecutePermission();
if (perm != null)
{
// Grants permission to execute the EvalBuf function.
// EvalBuf runs under code access security.
perm.assert(); //CodeAccessPermission로 부터 상속
// BP deviation documented.
print "Next will execute the string of code.";
pause; // Click Yes when asked to continue.
strResult = EvalBuf(strCodeToExecute);
// Close the code access permission scope.
CodeAccessPermission::revertAssert();
}
print "strResult is: [", strResult ,"]";
pause;
//
// Expected: "strResult is: [7]".
}
36. exp : 입력값에서 십진수의 자연진수로 반환한다.
= real exp(real arg)
ex)
static void expExample(Args _arg)
{
real r1;
real r2;
;
r1 = exp(2.302585093);
r2 = exp10(2.302585093);
print strFmt("exp of 2.302585093 is %1", r1);
print strFmt("exp10 of 230258 is %1", r2);
pause;
}
37. exp10 : 실수를 10진수로 변환한 값을 반환한다.
= real exp10(real decimal)
ex)
static void exp10Example(Args _arg)
{
real r1;
real r2;
;
r1 = exp(2.302585093);
r2 = exp10(2.302585093);
print strFmt("exp of 2.302585093 is %1", r1);
print strFmt("exp10 of 230258 is %1", r2);
pause;
}
38. extendedTypeNum : EDT의 id값을 반환한다.
= int extendedTypeNum(int str)
ex)
static void EDTNum(Args _args)
{
int i;
str s;
;
i = extendedTypeNum(AccountName);
s = extendedTypeStr(AccountName);
print int2Str(i);
print s;
pause;
}
39. extendedTypeStr : EDT의 이름을 스트링으로 반환한다.
= str extendedTypeStr(int str)
ex)
static void EDTStr(Args _args)
{
int i;
str s;
;
i = extendedTypeNum(AccountName);
s = extendedTypeStr(AccountName);
print int2Str(i);
print s;
pause;
}
40. fieldId2Name : 테이블의 id숫자와 필드의 id숫자로 지정된 필드의 이름을 보여주는 스트링값을 반환한다.
= str fieldId2Name(int tableid, int fieldid)
ex)
static void fieldId2NameExample(Args _arg)
{
str fn;
;
fn = fieldId2Name(tableName2Id("Customer"),7);
}
※ fieldName2Id : 테이블 ID number와 필드의 ID number에 의해서 정의된 테이블 필드의 필드 id를 반환한다.
int fieldName2Id(int tableid, str fieldname)
Parameter |
Description |
tableId |
The ID number for the table (note)Use the tableName2Id function to specify the ID of a table |
fieldname |
The name of the field |
ex)
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;
pause;
}
41. frac : 실수에서 소수 부분을 반환
= real frac(real decimal)
ex)
// Returns 0.423.
frac(12.423);
42.funcName : 현 함수의 문맥을 포함하는 스트링을 반환한다. 만약 실행이 클래스와 테이블을 포함하게 된다면, 메소드의 이름은 클래스나 테이블의 이름이 접두에 붙는다.
= str funcName()
ex)
//Current function context is Job5
static void funcNameExample(Args _arg)
{
print "Current function context is " + funcName();
pause;
}
43.fV : 투자한 값의 미래 결과치를 계산한다.
= real fV(real amount, real interest, real life)
amount - The amount paid in during each period.
interest - The interest rate.
life - The number of investment periods.
ex)
// Returns the value 1933.73.
fV(100,0.14,10);
// Returns the value 2442.04.
fV(400,0.10,5);
44.getPrefix : setPrefix function으로 연속해서 현실행 접두사로 반환한다
= str getPrefix()
ex)
static void getPrefixExample(Args _arg)
{
;
setPrefix("Prefix");
setPrefix("Another prefix");
print getPrefix();
pause;
}
45.guid2Str : noinformation
46.helpApplStr : noinformation
47.helpDevStr : noinformation
48.helpFileStr : noinformation
49.identifierStr : noinformation
50.idg : 구입비용과 기여 비율에 기초한 판매가격을 계산한다.
= real idg(real purchase, real contribution_ratio)
ex)
// Returns the value 1000.
idg(300,0.7);
// Returns the value 20000.
idg(11000,0.45);
51.indexId2Name : 인덱스 명을 반환한다.
= str indexId2Name(int tableid, int indexid)
ex)
// The result of calling indexId2Name is AddrIdx
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;
pause;
}
52.indexName2Id : 인덱스의 id를 반환한다.
= int indexName2Id(int tableid, str indexname)
ex)
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);
pause;
}
53.indexNum : noinformation
54.indexStr : noinformation
55.int2Str : 정수를 텍스트로 반환한다.
= str int2Str(int integer)
ex)
static void int2StrExample(Args _arg)
{
;
print "This is int2Str, value is " + int2Str(intMax());
print "This is int642Str, value is " + int642Str(int64Max());
pause;
}
56.int642Str : noinformation
57.intvMax : noinformation
58.intvName : noinformation
59.intvNo : noinformation
60.intvNorm : noinformation
61.licenseCodeNum :noinformation
62.licenseCodeStr : noinformation
63.literalStr : noinformation
64.log10
65.logN
66.match : noinformation
67.max : 2개의 값중에서 큰 쪽을 반환한다.
= anytype max(anytype object1, anytype object2)
ex)
// Returns the value 12.1.
max(12.0,12.1);
68.maxDate : date타입의 변수에서 허락하는 최고 큰 값을 반환한다. 아무 날짜나 이 날짜보다 작거나 같다.
= date maxDate()
ex) //2154-12-31
static void maxDateExample(Args _arg)
{
date maximumDate;
;
maximumDate = maxDate();
print maximumDate;
pause;
}
69.maxInt : 정수 타입에서 허락하는 가장 큰 값을 돌려준다. 어떤 정수 값도 반환되는 값보다 작거나 같다.
= int maxInt()
ex)
static void maxIntExample(Args _arg)
{
int i;
;
print "The maximum value for type int is " + int2Str(maxInt());
pause;
}
70.menuItemActionStr : noinformation
71.menuItemDisplayStr
72.menuItemOutputStr
73.menuStr : noinformation
74.methodStr : noinformation
75.min : 두 개의 비교값중에서 더 작은 값을 반환한다.
= anytype min(anytype object1, anytype object2)
ex)
static void minExample(Args _arg)
{
anytype a;
real r = 3.0;
real s = 2.0;
;
a = min(r, s);
print num2Str(a, 1, 2, 1, 1) + " is less than the other number.";
pause;
}
76.minInt :
77.mkDate : 각각 날짜, 월, 년을 가르키는 세개의 정수에 기초한 날짜를 생성한다.
= date mkDate(int day, int month, int year)
ex)//2005-01-01
static void mkDateExample(Args _arg)
{
date d;
;
// Returns the date 01\01\2005.
d = mkDate(1, 1, 2005);
print d;
pause;
}
78.mthName : 숫자로 지정된 해당 월의 이름을 반환한다.
= str monthName(int number)
ex)
static void mthNameExample(Args _arg)
{
str s;
;
// MthName(6) returns the text string "June".
s = mthName(6);
print "Month name is " + s;
pause;
}
79.mthOfYr : 지정된 날짜에 대한 월의 숫자를 반환한다.(January is month number 1.)
= int mthOfYr(date date)
ex)
static void mthOfYrExample(Args _arg)
{
int i;
;
i = mthOfYr(today());
print "The number of the month in today's date is " + int2Str(i);
pause;
}
80.newGuid : globally unique identifier (GUID)를 만든다.
= guid newGuid()
ex)
static void newGuidExample(Args _arg)
{
guid myGuid;
;
myGuid = newguid();
print strfmt("The GUID is: %1", myGuid);
}
81.nextMth : 지정된 날짜에 가장 가까운 다음 달의 일자를 반환한다. 예로 nextMth(29\02\1996) 는 29\03\1996로, nextMth(31\01\1996) 는 29\02\1996로 반환한다.
= date nextMth(date date)
ex)
static void nextMthExample(Args _arg)
{
date d;
;
d = nextMth(today());
print "Closest date next month is "
+ date2Str(d, 2, 2, -1, 2, -1, 4);
pause;
}
82.nextQtr : 지정된 날짜에 가장 가깝게 부합되는 다음 쿼터의 날짜를 반환한다. 예로 nextQtr(31\01\1998)는 30\04\1998를 반환한다.(대략 3달후)
= date nextQtr(date date)
ex)
static void nextQtrExample(Args _arg)
{
date d;
;
d = nextQtr(today());
print "Closest date next quarter is "
+ date2Str(d, 2, 2, -1, 2, -1, 4);
pause;
}
83.nextYr : 지정된 날짜에서 가장 가깝게 부합하는 다음 년도의 날짜를 반환한다. 예로 nextyr(29\02\1998)는 28\02\1999를 반환한다.
= date nextYr(date date)
ex)
static void nextYrExample(Args _arg)
{
date d;
;
d = nextYr(today());
print "Closest date next year is "
+ date2Str(d, 2, 2, -1, 2, -1, 4);
pause;
}
84.num2Char : 정수에 부합하는 ascii코드로 반환한다.
= str num2Char(int figure)
ex)
static void num2CharExample(Args _arg)
{
str s;
;
s = num2Char(42);
// Prints an asterisk?-the character represented by 42.
print s;
pause;
}
85.num2Date : 01\01\1900이후로 지정된 날수에 부합하는 날짜를 반환한다.
= date num2Date(int _days)
_days - The number of days after 1 January 1900 to return the date for.
ex)
// Returns the date 01/01/1901 (1 January 1901).
num2Date(366);
86.num2Str : 실수값에서 텍스트로 변환
= str num2Str(real number, int character, int decimals, int separator1, int separator2)
number - The number to convert to a text string.
character - The minimum number of characters required in the text.
decimals - The required number of decimals.
separator1 - The decimal separator. ( 1 - point(.), 2 - comma (,) )
separator2 - The thousands separator. ( 0 - no thousands separator, 1 - point(.), 2 - comma(,), 3 - space( ) )
ex)
// Returns 12.345,60.
num2Str(12345.6,10,2,2,1);
// Returns 12345.
num2Str(12345.6,1,0,1,0);
87.pmt : 대출금을 갚기 위해 매기간마다 지불되어야 하는 양을 계산한다.
= real pmt(real principal, real interest, real life)
principal - The amount that was originally borrowed.
interest - The interest that is applied each period to the amount borrowed.
life - The number of periods over which the loan is repaid.
ex)
// Returns the value 1372.82.
pmt(4000,0.14,4);
// Returns the value 1174.60.
pmt(10000,0.10,20);
88.power : 실수값에 대한 정해진 제곱값을 계산한다.
= real power(real arg, real exponent)
ex)
// Returns the value 25.0.
power(5.0,2.0);
// Returns the value 2.0.
power(4.0,0.5);
89.prevMth : 지정된 날짜의 가장 가까운 이전 달 값을 반환한다.
= date prevMth(date date)
ex)
// Returns the date 29/02/1996 (leap year).
prevMth(31\03\1996);
// Returns the date 28/01/1998.
prevMth(29\02\1998);
90.prevQtr : 지정된 날짜의 이전 쿼터를 계산한다(약 3달전 날짜)
= date prevQtr(date date)
ex)
// Returns the date 30/01/1998.
prevQtr(30\04\1998);
// Returns the date 29/02/1996 (leap year).
prevQtr(29\05\1996);
91.prevYr
92.primoYr :
93.prmIsDefault : 해당 날짜가 첫번째 날짜인지를 결정한다.
= int primoYr(date date)
(1 if date is a primo date; otherwise, 0.)
ex)
//Today is a primo date
//Today is not a primo date
static void primoYrExample(Args _arg)
{
;
if (primoYr(today()) == 1)
{
print "Today is a primo date";
}
else
{
print "Today is not a primo date";
}
pause;
}
94.pt : 주어진 값에 지정된 비율로 계산된 값의 합을 반환한다.
= real pt(real amount, real percentage)
ex)
// Returns the value 2200.0.
pt(2000.0,0.10);
95.pV : 연금의 현재값을 반환한다.
= real pv(real amount, real interest, real life)
amount - The amount paid during each period.
interest - The interest rate.
life - The number of times amount is paid.
ex)
// Returns the value 874.11.
pv(300,0.14,4);
96.queryStr : 현재 있는 쿼리를 나타내는 스트링을 반환한다.
= str queryStr(class _query)
ex)
static void queryStrExample(Args _arg)
{
// Prints the string AssetTable.
print queryStr(AssetTable);
// Results in compiler error saying that operand is not an element.
print queryStr(AssetTable);
pause;
}
97.rate : 현재 투자 값으로부터 일정 수의 기간을 넘어서 지정된 미래의 결과값을 받기위한 이율을 계산한다.
= real rate(real _future_value, real _current_value, real _terms)
_future_value - The future value of the investment.
_current_value - The current value of the investment.
_terms - The number of periods for which the investment spans.
ex)
// Returns the value 0.12.
rate(10000,1000,20);
98.refPrintAll : noinformation
99.reportStr : noinformation
100.resourceStr : noinformation
101.round : 정수를 지정된 형식으로 반올림한다.
= real round(real _arg, real _decimals)
ex)
// Returns the value 125.00.
round(123.45,5.00);
// Returns the value 7.35.
round(7.45,1.05);
102.runAs :
103.runBuf : 스트링으로 지나는 x++코드를 실행한다.
= anytype runBuf(str job,[anytype param])
job - The string that represents the code to be run.
param - The parameters for the code being passed to the function; optional.
104.securityKeyNum : noinformation
105.securityKeyStr : noinformation
106.sessionId : 현 세션의 세션값을 반환한다.
= int sessionId()
ex)
static void sessionIdExample(Args _arg)
{
int session;
;
session = sessionId();
print "This session ID is number " + int2Str(session);
pause;
}
107.setPrefix : 현 실행반경에 대해서 접두사를 지정한다.
= int setPrefix(str _prefix)
ex)
static void setPrefixExample(Args _arg)
{
int i;
;
i = setPrefix("Prefix");
print i;
pause;
}
108.sin
109.sinh
110.sleep : 밀리초단위로 시스템을 쉬도록 지정한다.
= int sleep(int _duration)
ex)
static void sleepExample(Args _arg)
{
int seconds = 10;
int i;
;
i = sleep(seconds*1000);
print "job slept for " + int2str(i/1000) + " seconds";
pause;
}
111.sln : 일정 가치하락 기간동안에 계속적인 가치하락 값을 반환한다.
= real sln(real price, real scrap, real life)
price - The purchase price of the asset.
scrap - The scrap value of the asset.
life - The number of periods in the expected life of the asset.
ex)
static void slnExample(Args _arg)
{
real r;
;
r = sln(100.00, 50.00, 50.00);
print r;
pause;
}
112.staticMethodStr
113.str2Date : 스트링을 날짜로 변환한다.
= date str2Date(str _text, str _sequence)
_text - The text string to convert to a date.
_sequence - The desired sequence in the date:
day: 1
month: 2
year: 3
For example, if the desired sequence is month, year, day, _sequence is written as 231.
ex)
static void str2DateExample(Args _arg)
{
date d;
;
d = str2Date("01/01/1999", 123);
print d;
pause;
}
114.str2Enum : 주어진 텍스트 스트링을 지정된 타입으로 계산한다.
= enum str2Enum(enum _type, str _text)
ex)
static void str2EnumExample(Args _arg)
{
BankAccountType bat;
;
str2Enum(bat,"Current");
}
115.str2Guid :
116.str2Int : 스트링을 해당하는 정수값으로 변환한다.
= int str2Int(str _text)
ex)
static void str2IntExample(Args _arg)
{
int i;
;
i = str2Int("1234567890");
print "i = " + int2Str(i);
pause;
}
117.str2Int64
118.str2Num : 스타링을 실수값으로 변환한다.
= real str2Num(str _text)
str2Num("123.45") returns the value 123.45.
str2Num("a123") returns the value 0.0.
str2Num("123a") returns the value 123.00
ex)
static void str2NumExample(Args _arg)
{
real r;
;
r = str2Num("3.15");
print strFmt("r = %1", r);
pause;
}
119.str2Time :
ex)
static void str2TimeExample(Args _arg)
{
int i;
;
i = str2Time("11:30");
print i;
pause;
}
120.strAlpha : 문자나 숫자가 아닌 다른 캐릭터는 모두 삭제한다
= str strAlpha(str _text)
ex)
static void strAlphaExample(Args _arg)
{
str s;
;
s = strAlpha("?a*bc123.");
print s;
pause;
}
121.strCmp : 주어진 두개의 스트링값을 비교한다. 비교케이스는 상황에 따라 다르다.
= int strCmp(str text1, str text2)
ex)
// Returns 0.
print strCmp("abc", "abc");
// Returns 1.
print strCmp("abc", "ABC");
// Returns -1.
print strCmp("aaa", "bbb");
// Returns 1.
print strCmp("ccc", "bbb");
122.strColSeq : 대문자를 전체 소문자로 변환한다
= str strColSeq(str text)
ex)
static void strColSeqExample(Args _arg)
{
;
print strColSeq("AbcDEaBCde");
pause;
}
123.strDel : 문자열중에서 특정 부분을 삭제한다.
= str strDel(str _text, int _position, int _number)
_text - The text string to delete characters from.
_position - The position at which to start deleting characters.
_number - The number of characters to delete (including the character at position).
A minus in front of _number indicates that the (_number-1) characters before the character at _position are to be removed along with the character at _position.
ex)
// Returns the text string AEFGH.
strDel("ABCDEFGH",2,3);
// Returns the text string ABCGH.
strDel("ABCDEFGH",4,3);
124.strFind : 주어진 스트링에서 찾아야 하는 캐릭터의 첫번째 발견지를 찾아낸다.
= int strFind(str _text, str _characters, int _position, int _number)
_number - The number of characters to search, beginning at the character at _position.
If the number is negative, the system searches the number of characters backward from the specified position.
ex)
// Returns the value 4 (the position where "D" was found).
strFind("ABCDEFGHIJ","KHD",1,10);
// Returns the value 8 (the position where "H" was found).
strFind("ABCDEFGHIJ","KHD",10,-10);
125.strFmt : 포맷관련
126.strIns : 택스트 부분에 대해서 다른 택스트를 입력한다.
= str strIns(str _text1, str _text2, int _position)
ex)
// Returns the text string ABCDEFGH.
strIns("ABFGH","CDE",3);
127.strKeep : 해당 문자열에서 지정된 문자를 제외한 모든 부분을 삭제한다.
= str strKeep(str _text1, str _text2)
ex)
// Returns the text string BBCDDB.
strKeep("ABBCDDEFGHB","BCD");
128.strLen : 문자열 길이를 반환한다.
ex)
// Returns the value 10.
strLen("ABCDEFGHIJ");
129.strLine : 새 열(\n)을 사용함으로써 만들어진 여러개의 라인의 스트링값으로부터 한줄한줄을 반환한다.
ex)
static void strLineExample(Args _arg)
{
str mytxt = "first-line\nsecond-line\nlast-line";
;
// Prints "second-line".
print strLine(mytxt,1);
// Prints "last-line".
print strLine(mytxt,2);
pause;
}
130.strLTrim : 택스트로 부터 앞부분의 빈공간을 없앤다.
ex)
// Returns the text string "ABC-DEFG".
strLTrim(" ABC-DEFG");
131.strLwr : noinformation
132.strNFind : 지정된 문자가 아닌 문자가 있는 문자열의 자리를 숫자로 반환한다.
= int strNFind( str _text, str _characters, int _position, int _number)
ex)
// Returns the value 5 (the position of "E").
strNFind("ABCDEFGHIJ","ABCDHIJ",1,10);
// Returns the value 6 (the position of "H").
strNFind("CDEFGHIJ","CDEFGIJ",10,-10);
133.strPoke : 스트링 값의 일부분에 다른 택스트 스트링을 덮어 쓰다.
134.strPrompt : 콜론(:)과 스페이스가 있는 주기가 첨가된 입력스트링값을 길이보다 더 긴 스트링이 나타난다.
= str strPrompt(str _string, _int len)
ex)
static void JobStrPromptDemo(Args _args)
{
// Printed string is "[abc..: ]"
print "[", strPrompt("abc", 7), "]";
pause;
}
135.strRem : 스트링에서 없애고자 하는 문자를 삭제한다.
= str strRem(str text1, str text2)
ex)
// Returns the text string "BDFBDF".
strRem("ABCDEFGABCDEFG","ACEG");
136.strRep : 스트링의 문자를 반복한다.
= str strRep(str _text, str _number)
ex)
static void strRepExample(Args _arg)
{
str strL;
;
strL = strRep("AB",6);
print strL;
pause;
}
137.strRTrim : 스트링에서 모든 빈공간을 삭제한다.
= str strRTrim(str _text)
ex)
// Returns the string ABC-DEFG-.
strRTrim("ABC-DEFG- ");
138.strScan : 어떠한 스트링에 대해 다른 스트링의 값을 조회한다.
= int strScan( str _text1, str _text2, int _position, int _number)
text1 - The text string to search.
_text2 - The string to find.
_position - The position at which the search should start.
_number - The number of characters that should be searched.
If there is a minus in front of _number, the system searches the number of characters in reverse order from the specified position.
ex)
// Returns the value 4 (the position of text string "DEF").
strScan("ABCDEFGHIJ","DEF",1,10);
// Returns the value 3 (the position of text string "CDE").
strScan ("ABCDEFGHIJ","CDE",10,-10);
139.strUpr : noinformation
130.subStr :
= str subStr(str _text, int _position, int _number)
ex)
// Returns the text string CDEFG.
subStr("ABCDEFGHIJ",3,5);
// Returns the text string DEFG.
subStr("ABCDEFGHIJ",7,-4);
141.syd : 일정한 기간동안 자산의 가치하락을 계산한다.
= real syd(real _price, real _scrap, real _life, int _period)
_price - The purchase price of the asset.
_scrap - The scrap value of the asset.
_life - The expected life of the asset (the number of periods).
_period - The period for which to calculate depreciation.
ex)
// Returns the value 2666.67 (for the 1st period).
syd(10000,2000,5,1);
// Returns the value 2133.33 (for the 2nd period).
syd(10000,2000,5,2);
// Returns the value 1600.00 (for the 3rd period).
syd(10000,2000,5,3);
// Returns the value 1066.67 (for the 4th period).
syd(10000,2000,5,4);
// Returns the value 533.33 (for 5th - and final- period).
syd(10000,2000,5,5);
142.systemDateGet : 현재 날짜 반환한다.
143.systemDateSet : 시스템의 일자를 수정한다.
ex)
static void systemDateSetExample(Args _arg)
{
date d = today();
;
d = systemDateSet(d);
print d;
pause;
}
144.tableCollectionStr : noinformation
145.tableFieldGroupStr : 특정한 필드 이름을 보여주는 스트링을 반환한다.
= str tableFieldGroupStr(int table, str fieldgroupname)
table - The table that contains the field group.
fieldgroupname - The name of the field group to return.
ex)
static void tableFieldGroupStrExample(Args _arg)
{
str MyTxt;
;
MyTxt = tableFieldGroupStr(Address, ContactInfo);
}
146.tableId2Name : 테이블 이름이 포함된 스트링이 반환된다.
= str tableId2Name(int _tableid)
ex)
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;
pause;
}
147.tableId2PName : 프린트 할 테이블 명을 가진 스트링을 반환한다.
= str tableId2PName(int _fieldid)
ex)
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;
pause;
}
148.tableMethodStr : noinformation
149.tableName2Id : 테이블의 id를 반환한다.
= int tableName2Id(str _name)
ex)
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;
pause;
}
140.tableNum : noinformation
151.tablePName : noinformation
152.tableStaticMethodStr : noinformation
153.tableStr : noinformation
154.tan
155.tanh
156.term : noinformation
157.time2Str :
= str time2Str( int _time, int _separator, int _timeFormat)
_time - The number of seconds since midnight.
_separator - The characters to be used as separators in the text string. Possible values follow:
0 ? regional settings for the operating system
1 ? colon (:)
2 ? point (.)
3 ? space ( )
4 ? comma (,)
5 ? forward slash (/)
_timeFormat - Determines whether a 12-hour or 24-hour clock is used. Possible values follow:
0 ? regional settings for the operating system
1 ? 24-hour clock (15:00:00)
2 ? 12-hour clock (3:00:00pm)
ex)
// Returns the text string 05:01:38.
time2Str(18098,1,1);
// Returns the text string 05:01:38 am.
time2Str(18098,1,2);
// Returns the text string 05 01 39.
time2Str(18099,3,1);
// Returns the text string 05/01/39 am.
time2Str(18099,5,2);
158.timeNow : 현시간 값을 반환한다. 자정부터 시작해서 밀리세컨으로 반환된다.
= int timeNow()
ex)
static void timeNowExample(Args _arg)
{
int i;
;
i = timeNow();
print "The number of seconds since midnight is " + int2Str(i);
pause;
}
159.today : 시스템상의 현재일자를 반환한다.
ex)
static void todayExample(Args _arg)
{
date d;
;
d = today();
print "Today's date is " + date2Str(d, 0, 2, -1, 2, -1, 4);
pause;
}
150.trunc : 소수점 부분을 삭제한다(버림)
= real trunc(real _decimal)
ex)
static void truncExample(Args _arg)
{
real r;
;
r = trunc(2.7147);
print strFmt("r = %1", r);
pause;
}
161.typeId : noinformation
162.typeOf : 속성의 타입을 반환한다.
= enum typeOf(anytype _object)
ex)
if(typeof(conpeek(c, 1)) != Types::Container ||
conlen(conpeek(c, 1)) != 1 ||
typeof(conpeek(conpeek(c, 1), 1)) != Types::Integer)
{
// More code.
}
163.uint2Str : noinformation
164.ultimoYr : noinformation
165.varStr : noinformation
166.webActionItemStr
167.webDisplayContentItemStr
168.webFormStr
169.webletItemStr
170.webMenuStr
171.webOutputContentItemStr
172.webpageDefStr
173.webReportStr
174.websiteDefStr
175.websiteTempStr
176.webStaticFileStr
177.webUrlItemStr
178.webWebpartStr
179.wkOfYr : 해당일자가 들어간 년도의 해당 주를 계산한다.
= int wkOfYr(date _date)
ex)
// Returns the value 6: the 6th week of 1998.
wkOfYr(02\02\1998);
180.year : 해당일의 년도를 반환한다.
= int year(date _date)
ex)
// Returns the value 1998.
year(02\02\1998);
/*---------------------------------쿼리문 넣고 실행하는 부분 ----------------------------------*/
//http://msdn2.microsoft.com/en-us/library/aa636695.aspx
--UserConnection Class
/*
The UserConnection class represents an auxiliary connection to the SQL database, based on the same login properties as the main connection.
Copy Code
class UserConnection extends Connection
*/
static void example()
{
UserConnection Con = new UserConnection();
Statement Stmt = Con.createStatement();
ResultSet R = Stmt.executeQuery('SELECT VALUE FROM SQLSYSTEMVARIABLES');
while ( R.next() )
{
print R.getString(1);
}
}
'Dynamics AX > Development' 카테고리의 다른 글
Dynamics AX 2012에서 Legal Entity 삭제 방법 (0) | 2015.01.19 |
---|---|
X++에서 AX 2012 Table에 이미지 저장하기 (0) | 2015.01.16 |
Split String in Dynamics AX (0) | 2014.09.10 |
X++에서 XML 파일로 데이터 저장하고 읽기 (0) | 2014.08.02 |
X++에서 직접 SQL 실행하기 (0) | 2014.07.29 |