mardi 8 octobre 2013

Functions and Macros

X++ Functions [AX 2012]


Applies To: Microsoft Dynamics AX 2012 R2, Microsoft Dynamics AX 2012 Feature Pack, Microsoft Dynamics AX 2012
In Microsoft Dynamics AX, the X++ language provides more than 100 system functions that are not part of any class. The two types of functions are as follows:
  • Run time – functions that are executed during run time.
  • Compile time – functions that are executed during compile time.

Run time functions used for data type conversions, mathematical operations, and so on. Some common run time functions are as follows:
  • str2Int – creates an int value from a str value.
  • abs – creates a positive real value from a real value that is either positive or negative.
  • conFind – retrieves the location of an element in a container.
For more information, see the reference topics that are listed under Functions.

Call Run Time Functions from .NET

The logic of the X++ run time functions is also implemented in the following .NET assembly:
Microsoft.Dynamics.AX.Xpp.Support.DLL
Inside the previous assembly, the X++ run time functions are implemented as static methods of the following class:
Microsoft.Dynamics.AX.Xpp.PredefinedFunctions

Compile time functions are executed early in the compile of X++ code. Most of these functions retrieve metadata about items that are in the Application Object Tree (AOT). Some common compile time functions are as follows:
  • classNum – retrieves the ID of a class.
  • classStr – verifies during compile time that a class by that name exists. This is better than discovering the error later during run time.
  • evalBuf – evaluates the input string of X++ code, and then returns the results as a string.
  • literalStr – retrieves a label ID when given the string representation of a label, such as the string "@SYS12345". For example, myLabel.exists(literalStr("@SYS12345"));.

NoteNote
Compile time functions are sometimes called intrinsic functions.
NoteNote
X++ compile time functions cannot be called from a .NET program.
For more information, see Intrinsic Functions.



======================================================================



X++ Function Categories and their Functions [AX 2012]



Applies To: Microsoft Dynamics AX 2012 R2, Microsoft Dynamics AX 2012 Feature Pack, Microsoft Dynamics AX 2012
This topic lists every X++ built-in function by category.

The following table lists only the categories of X++ functions. Each category is described. These categories help people to understand the many functions, but the categories do not represent any formal construct in Microsoft Dynamics AX.
Category
Description
Business
Functions that input financial data and calculate formulas.
Compiler Verified
(also named Intrinsic)
Functions that have their input value verified by the compiler. If the input value is not found to match any existing object in the Application Object Tree (AOT), the compiler issues an error.
The inputs to these functions must be literals, because the compiler cannot determine the value that a variable contains at run time.
Container
Functions that operate on the container data type of X++.
Convert
Functions that translate data of one type into data of another type.
Date
Functions that operate on the date data type.
Enum
Functions that operate on enum objects.
Math
Functions that perform mathematical calculations.
Miscellaneous
Functions that do not belong to any specific category.
Reflection
Functions that access the metadata about objects and return other metadata about them.
Session
Functions that change or report on the context of the current user connection.
String
Functions that operate on the str data type.

The following table lists the X++ functions that belong in each previous category.
Category
X++ function
Business
  • cTerm
  • ddb
  • dg
  • fv
  • idg
  • intvMax
  • intvName
  • intvNo
  • intvNorm
  • pmt
  • pt
  • pv
  • rate
  • sln
  • syd
  • term
Compiler Verified
(also named Intrinsic)
  • attributeStr
  • classNum
  • classStr
  • configurationKeyNum
  • configurationKeyStr
  • datasetStr
  • enumNum
  • enumStr
  • evalBuf
  • extendedTypeNum
  • extendedTypeStr
  • fieldNum
  • fieldPName
  • fieldStr
  • formControlStr
  • formStr
  • identifierstr
  • indexNum
  • indexStr
  • licenseCodeNum
  • licenseCodeStr
  • literalStr
  • menuItemActionStr
  • menuItemDisplayStr
  • menuItemOutputStr
  • menuStr
  • methodStr
  • perspectiveNum
  • perspectiveStr
  • queryDataSourceStr
  • queryStr
  • reportStr
  • resourceStr
  • runBuf
  • securityKeyNum
  • securityKeyStr
  • ssrsReportStr
  • staticMethodStr
  • tableCollectionStr
  • tableFieldGroupStr
  • tableMethodStr
  • tableNum
  • tablePName
  • tableStaticMethodStr
  • tableStr
  • varStr
  • webActionItemStr
  • webDisplayContentItemStr
  • webFormStr
  • webletItemStr
  • webMenuStr
  • webOutputContentItemStr
  • webPageDefStr
  • webReportStr
  • webSiteDefStr
  • webSiteTempStr
  • webStaticFileStr
  • webUrlItemStr
  • webWebpartStr
  • workflowApprovalStr
  • workflowCategoryStr
  • workflowTaskStr
  • workflowTemplateStr
Container
  • conDel
  • conFind
  • conIns
  • conLen
  • conNull
  • conPeek
  • conPoke
Convert
  • any2Enum
  • any2Date
  • any2Guid
  • any2Int
  • any2Int64
  • any2Real
  • any2Str
  • char2Num
  • Date2Num
  • Date2Str
  • Datetime2Str
  • formattedStr2Num
  • guid2Str
  • int2Str
  • int642Str
  • num2Char
  • num2Date
  • num2Str
  • str2Enum
  • str2Date
  • str2Datetime
  • str2Guid
  • str2Int
  • str2Int64
  • str2Num
  • str2Time
  • time2Str
  • uint2Str
Date
  • dayName
  • dayOfMth
  • dayOfWk
  • dayOfYr
  • endMth
  • maxDate
  • mkDate
  • mthName
  • mthOfYr
  • nextMth
  • nextQtr
  • nextYr
  • prevMth
  • prevQtr
  • prevYr
  • timeNow
  • today
  • wkOfYr
  • year
Enum
  • enum2Str
  • enumCnt
Math
  • abs
  • acos
  • asin
  • atan
  • corrFlagGet
  • corrFlagSet
  • cos
  • cosh
  • decRound
  • exp
  • exp10
  • frac
  • log10
  • logN
  • power
  • round
  • sin
  • sinh
  • tan
  • tanh
  • trunc
Miscellaneous
  • beep
  • classIdGet
  • dimOf
  • getPrefix
  • max
  • maxInt
  • min
  • minInt
  • newGuid
  • setPrefix
  • sleep
  • systemDateget
  • systemDateset
Reflection
  • fieldId2Name
  • fieldId2PName
  • fieldName2Id
  • indexId2Name
  • indexName2Id
  • refPrintAll
  • tableId2Name
  • tableId2PName
  • tableName2Id
  • typeOf
Session
  • curExt
  • curUserId
  • getCurrentPartition
  • getCurrentPartitionRecId
  • SessionId
  • funcName
  • prmIsDefault
  • runAs
String
  • match
  • strAlpha
  • strCmp
  • strColSeq
  • strDel
  • strFind
  • strFmt
  • strIns
  • strKeep
  • strLen
  • strLine
  • strLTrim
  • strLwr
  • strNFind
  • strPoke
  • strPrompt
  • strRem
  • strRep
  • strRTrim
  • strScan
  • strUpr
  • subStr

Aucun commentaire:

Enregistrer un commentaire