{"id":28180,"date":"2017-06-14T12:09:53","date_gmt":"2017-06-14T04:09:53","guid":{"rendered":"http:\/\/localhost\/help\/?page_id=28180"},"modified":"2024-08-15T10:31:32","modified_gmt":"2024-08-15T02:31:32","slug":"string","status":"publish","type":"page","link":"https:\/\/oihelp.corporate.ifs.com\/help\/p2-server\/calculations\/string\/","title":{"rendered":"String()"},"content":{"rendered":"\n<h2><span id=\"Format\">Format<\/span><\/h2>\n<p class=\"intro-text\"><strong>String(Arg1, [FormatString])<\/strong><\/p>\n<h2><span id=\"Returns\">Returns<\/span><\/h2>\n<p class=\"intro-text\">Converts the supplied argument into a String\u00a0data type.<\/p>\n<h2>Inputs<\/h2>\n<p class=\"intro-text\"><strong>Arg1<\/strong>: The argument to be converted.<br \/>\nBehaviour:\u00a0Required<br \/>\nDimension: Collection, SingleValue, MultiCollection<br \/>\nValid data types: Boolean, DateTime, Decimal, Integer, Duration<\/p>\n<p class=\"intro-text\"><b>FormatString<\/b>: The string specifying how to format the result. This must be in quotation marks. Only used when <strong>Arg1<\/strong> is a <em>DateTime<\/em> or <em>Duration<\/em>\u00a0data type.<br \/>\nBehaviour: Optional<br \/>\nDimensions: SingleValue<br \/>\nValid data types: String<\/p>\n<p class=\"left-bar\"><a href=\"https:\/\/oihelp.corporate.ifs.com\/help\/p2-server\/calculations\/calculation-syntax\/#Data_Type\">How to format data types<\/a><\/p>\n<h2><span id=\"Format_Codes\"><span id=\"Examples\">Format Codes<\/span><\/span><\/h2>\n<p class=\"intro-text\">The following codes within the FormatString are replaced with the relevant information.\u00a0<\/p>\n<ul>\n<li class=\"intro-text\">The codes must be in quotation marks. E.g. \"Day\"<\/li>\n<li class=\"intro-text\">You may concatenate the codes to produce the desired string. E.g. \"DayMonth\"<\/li>\n<li class=\"intro-text\">You may include other text, spaces, and punctuation within the quotation marks. E.g. \"Day, Month\"<\/li>\n<li class=\"intro-text\">Any other text within the quotation marks\u00a0is converted to upper case.<\/li>\n<\/ul>\n<h3 class=\"page-subheading\">For DateTime\u00a0arguments<\/h3>\n<ul class=\"intro-text\">\n<li>The codes are not case sensitive.<\/li>\n<\/ul>\n<table>\n<tbody>\n<tr style=\"border: 1px solid #cccccc;\">\n<td style=\"padding-left: 5px;\" width=\"81\"><strong>DDD<\/strong><\/td>\n<td width=\"373\">Day of year (001 to 366)<\/td>\n<\/tr>\n<tr style=\"border: 1px solid #cccccc;\">\n<td style=\"padding-left: 5px;\" width=\"81\"><strong>DAY<\/strong><\/td>\n<td width=\"373\">Full weekday name<\/td>\n<\/tr>\n<tr style=\"border: 1px solid #cccccc;\">\n<td style=\"padding-left: 5px;\" width=\"81\"><strong>DY<\/strong><\/td>\n<td width=\"373\">Abbreviated weekday name, e.g. FRI<\/td>\n<\/tr>\n<tr style=\"border: 1px solid #cccccc;\">\n<td style=\"padding-left: 5px;\" width=\"81\"><strong>MONTH<\/strong><\/td>\n<td width=\"373\">Full month name<\/td>\n<\/tr>\n<tr style=\"border: 1px solid #cccccc;\">\n<td style=\"padding-left: 5px;\" width=\"81\"><strong>MON<\/strong><\/td>\n<td width=\"373\">Abbreviated month name, e.g. AUG<\/td>\n<\/tr>\n<tr style=\"border: 1px solid #cccccc;\">\n<td style=\"padding-left: 5px;\" width=\"81\"><strong>HH<\/strong><\/td>\n<td width=\"373\">Hour in 12 hour format (1 - 12)<\/td>\n<\/tr>\n<tr style=\"border: 1px solid #cccccc;\">\n<td style=\"padding-left: 5px;\" width=\"81\"><strong>YYYY<\/strong><\/td>\n<td width=\"373\">Four-digit year<\/td>\n<\/tr>\n<tr style=\"border: 1px solid #cccccc;\">\n<td style=\"padding-left: 5px;\" width=\"81\"><strong>A.M.<\/strong><\/td>\n<td width=\"373\">AM or PM indicator<\/td>\n<\/tr>\n<tr style=\"border: 1px solid #cccccc;\">\n<td style=\"padding-left: 5px;\" width=\"81\"><strong>AM<\/strong><\/td>\n<td width=\"373\">AM or PM indicator<\/td>\n<\/tr>\n<tr style=\"border: 1px solid #cccccc;\">\n<td style=\"padding-left: 5px;\" width=\"81\"><strong>P.M.<\/strong><\/td>\n<td width=\"373\">AM or PM indicator<\/td>\n<\/tr>\n<tr style=\"border: 1px solid #cccccc;\">\n<td style=\"padding-left: 5px;\" width=\"81\"><strong>PM<\/strong><\/td>\n<td width=\"373\">AM or PM indicator<\/td>\n<\/tr>\n<tr style=\"border: 1px solid #cccccc;\">\n<td style=\"padding-left: 5px;\" width=\"81\"><strong>WW<\/strong><\/td>\n<td width=\"373\">Week of year, if Sunday is the first day of the week<\/td>\n<\/tr>\n<tr style=\"border: 1px solid #cccccc;\">\n<td style=\"padding-left: 5px;\" width=\"81\"><strong>IW<\/strong><\/td>\n<td width=\"373\">Week of year, if Monday is the first day of the week<\/td>\n<\/tr>\n<tr style=\"border: 1px solid #cccccc;\">\n<td style=\"padding-left: 5px;\" width=\"81\"><strong>DD<\/strong><\/td>\n<td width=\"373\">Day of month (01 to 31)<\/td>\n<\/tr>\n<tr style=\"border: 1px solid #cccccc;\">\n<td style=\"padding-left: 5px;\" width=\"81\"><strong>MM<\/strong><\/td>\n<td width=\"373\">Month (01 to 12)<\/td>\n<\/tr>\n<tr style=\"border: 1px solid #cccccc;\">\n<td style=\"padding-left: 5px;\" width=\"81\"><strong>MI<\/strong><\/td>\n<td width=\"373\">Minutes (00 to 59)<\/td>\n<\/tr>\n<tr style=\"border: 1px solid #cccccc;\">\n<td style=\"padding-left: 5px;\" width=\"81\"><strong>SS<\/strong><\/td>\n<td width=\"373\">Seconds (00 to 59)<\/td>\n<\/tr>\n<tr style=\"border: 1px solid #cccccc;\">\n<td style=\"padding-left: 5px;\" width=\"81\"><strong>D<\/strong><\/td>\n<td width=\"373\">Day of week<\/td>\n<\/tr>\n<tr style=\"border: 1px solid #cccccc;\">\n<td style=\"padding-left: 5px;\" width=\"81\"><strong>IY<\/strong><\/td>\n<td width=\"373\">Two-digit year (00 to 99)<\/td>\n<\/tr>\n<tr style=\"border: 1px solid #cccccc;\">\n<td style=\"padding-left: 5px;\" width=\"81\"><strong>YY<\/strong><\/td>\n<td width=\"373\">Two-digit year (00 to 99)<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3 class=\"page-subheading\">For Duration\u00a0arguments<\/h3>\n<ul>\n<li class=\"intro-text\">The codes are case sensitive.<\/li>\n<li class=\"intro-text\">The default pattern is: <span class=\"code-fragment\">D:hh:mm:ss.FFFFFFF<\/span>, where:<\/li>\n<\/ul>\n<table>\n<tbody>\n<tr style=\"border: 1px solid #cccccc;\">\n<td style=\"padding-left: 5px;\" width=\"81\"><strong>D<\/strong><\/td>\n<td width=\"373\">Day of month (01 to 31)<\/td>\n<\/tr>\n<tr style=\"border: 1px solid #cccccc;\">\n<td style=\"padding-left: 5px;\" width=\"81\"><strong>hh<\/strong><\/td>\n<td width=\"373\">Hour in 12 hour format (1 - 12)<\/td>\n<\/tr>\n<tr style=\"border: 1px solid #cccccc;\">\n<td style=\"padding-left: 5px;\" width=\"81\"><strong>mm<\/strong><\/td>\n<td width=\"373\">Minutes (00 to 59)<\/td>\n<\/tr>\n<tr style=\"border: 1px solid #cccccc;\">\n<td style=\"padding-left: 5px;\" width=\"81\"><strong>ss<\/strong><\/td>\n<td width=\"373\">Seconds (00 to 59)<\/td>\n<\/tr>\n<tr style=\"border: 1px solid #cccccc;\">\n<td style=\"padding-left: 5px;\" width=\"81\"><strong>FFFFFFF<\/strong><\/td>\n<td width=\"373\">Milliseconds (0 to 9999999)<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p class=\"intro-text\">The following custom patterns are also available for duration\u00a0types:<\/p>\n<table>\n<thead>\n<tr style=\"border: 1px solid #cccccc;\">\n<td style=\"padding-left: 5px;\" width=\"100\"><strong>Character<\/strong><\/td>\n<td width=\"400\"><strong>Meaning<\/strong><\/td>\n<td><strong>Example<\/strong><\/td>\n<\/tr>\n<\/thead>\n<tbody>\n<tr style=\"border: 1px solid #cccccc;\">\n<td style=\"padding-left: 5px;\"><strong>D (DD etc)<\/strong><\/td>\n<td>Total days<\/td>\n<td>54 hours with a pattern of D:hh:mm \u2192 <span style=\"color: #0000ff;\">2:06:00<\/span><\/td>\n<\/tr>\n<tr style=\"border: 1px solid #cccccc;\">\n<td style=\"padding-left: 5px;\"><strong>H (HH etc)<\/strong><\/td>\n<td>Total hours<\/td>\n<td>54 hours with a pattern of H:mm \u2192\u00a0<span style=\"color: #0000ff;\">54:00<\/span><\/td>\n<\/tr>\n<tr style=\"border: 1px solid #cccccc;\">\n<td style=\"padding-left: 5px;\"><strong>h or hh<\/strong><\/td>\n<td>Hours within a day (0-23)<\/td>\n<td>54 hours with a pattern of D:hh \u2192\u00a0<span style=\"color: #0000ff;\">2:06<\/span><\/td>\n<\/tr>\n<tr style=\"border: 1px solid #cccccc;\">\n<td style=\"padding-left: 5px;\"><strong>M (MM etc)<\/strong><\/td>\n<td>Total minutes<\/td>\n<td>3 hours and 10 minutes with a pattern of M:ss \u2192\u00a0<span style=\"color: #0000ff;\">190:00<\/span><\/td>\n<\/tr>\n<tr style=\"border: 1px solid #cccccc;\">\n<td style=\"padding-left: 5px;\"><strong>m or mm<\/strong><\/td>\n<td>Minutes within an hour (0-59)<\/td>\n<td>3 hours and 10 minutes with a pattern of H:mm:ss \u2192\u00a0<span style=\"color: #0000ff;\">3:10:00<\/span><\/td>\n<\/tr>\n<tr style=\"border: 1px solid #cccccc;\">\n<td style=\"padding-left: 5px;\"><strong>S (SS etc)<\/strong><\/td>\n<td>Total seconds<\/td>\n<td>2 minutes and 10 seconds with a pattern of S.fff \u2192\u00a0<span style=\"color: #0000ff;\">70.000<\/span><\/td>\n<\/tr>\n<tr style=\"border: 1px solid #cccccc;\">\n<td style=\"padding-left: 5px;\"><strong>s or ss<\/strong><\/td>\n<td>Seconds within a minute (0-59)<\/td>\n<td>2 minutes and 10 seconds with a pattern of M:ss.fff \u2192\u00a0<span style=\"color: #0000ff;\">2:10.000<\/span><\/td>\n<\/tr>\n<tr style=\"border: 1px solid #cccccc;\">\n<td style=\"padding-left: 5px;\"><strong>f ... fffffff<\/strong><\/td>\n<td>The fractional second part of the duration, using exactly the specified number of characters. Trailing digits are truncated towards zero.<\/td>\n<td>1 second, 1234500 ticks: s.fffffff \u2192\u00a0<span style=\"color: #0000ff;\">1.1234500<\/span> <br \/>\nExactly 1 second: s.f \u2192\u00a0<span style=\"color: #0000ff;\">1.0<\/span><\/td>\n<\/tr>\n<tr style=\"border: 1px solid #cccccc;\">\n<td style=\"padding-left: 5px;\"><strong>F ... FFFFFFF<\/strong><\/td>\n<td>The fractional second part of the duration, using at most the specified number of characters (up to 7). Trailing digits are truncated towards zero, and trailing insignificant zeroes are truncated. If this comes after a decimal separator and the value is zero, the decimal separator is also truncated.<\/td>\n<td>1 second, 1234500 ticks: s.FFFFFFF \u2192\u00a0<span style=\"color: #0000ff;\">1.12345<\/span> <br \/>\nExactly 1 second: s.F \u2192\u00a0<span style=\"color: #0000ff;\">1<\/span><\/td>\n<\/tr>\n<tr style=\"border: 1px solid #cccccc;\">\n<td style=\"padding-left: 5px;\"><strong>+<\/strong><\/td>\n<td>The sign of the value, always specified whether positive or negative. The character used will depend on the format provider; + and - are used by the invariant culture.<\/td>\n<td>Positive value: +HH:mm \u2192\u00a0<span style=\"color: #0000ff;\">+07:30<\/span> <br \/>\nNegative value: +HH:mm -&gt; <span style=\"color: #0000ff;\">-07:30<\/span><\/td>\n<\/tr>\n<tr style=\"border: 1px solid #cccccc;\">\n<td style=\"padding-left: 5px;\"><strong>-<\/strong><\/td>\n<td>The sign of the value, only specified when the value is negative. The character used will depend on the format provider; - is used by the invariant culture.<\/td>\n<td>Positive value: -HH:mm \u2192\u00a0<span style=\"color: #0000ff;\">07:30<\/span> <br \/>\nNegative value: -HH:mm \u2192\u00a0<span style=\"color: #0000ff;\">-07:30<\/span><\/td>\n<\/tr>\n<tr style=\"border: 1px solid #cccccc;\">\n<td style=\"padding-left: 5px;\"><strong>.<\/strong><\/td>\n<td>This is <em>always<\/em> a period (\".\"); not a culture-sensitive decimal separator. The only difference between a period and any other literal character is that when followed by a series of \"F\" characters, the period will be removed if there are no fractional seconds.<\/td>\n<td>&nbsp;<\/td>\n<\/tr>\n<tr style=\"border: 1px solid #cccccc;\">\n<td style=\"padding-left: 5px;\"><strong>:<\/strong><\/td>\n<td>The time separator for the format provider; colon in the invariant culture.<\/td>\n<td>HH:mm \u2192\u00a0<span style=\"color: #0000ff;\">07:30<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p class=\"intro-text\">Other special characters available in duration types:<\/p>\n<table>\n<thead>\n<tr style=\"border: 1px solid #cccccc;\">\n<td style=\"padding-left: 5px;\"><strong>Character<\/strong><\/td>\n<td><strong>Meaning<\/strong><\/td>\n<td><strong>Example<\/strong><\/td>\n<\/tr>\n<\/thead>\n<tbody>\n<tr style=\"border: 1px solid #cccccc;\">\n<td style=\"padding-left: 5px;\"><strong>%<\/strong><\/td>\n<td>Escape to force a single-character custom pattern to be treated as such.<\/td>\n<td>%H \u2192\u00a0<span style=\"color: #0000ff;\">5<\/span><\/td>\n<\/tr>\n<tr style=\"border: 1px solid #cccccc;\">\n<td style=\"padding-left: 5px;\"><strong>'<\/strong><\/td>\n<td>Open and close a text literal, which can include double quotes.<\/td>\n<td>HH'H'mm'M' \u2192\u00a0<span style=\"color: #0000ff;\">07H30M<\/span><\/td>\n<\/tr>\n<tr style=\"border: 1px solid #cccccc;\">\n<td style=\"padding-left: 5px;\"><strong>\"<\/strong><\/td>\n<td>Open and close a text literal, which can include single quotes.<\/td>\n<td>HH\"'\"mm \u2192\u00a0<span style=\"color: #0000ff;\">07'30<\/span><\/td>\n<\/tr>\n<tr style=\"border: 1px solid #cccccc;\">\n<td style=\"padding-left: 5px;\"><strong>\\<\/strong><\/td>\n<td>Escapes the following character.<\/td>\n<td>HH\\'mm \u2192\u00a0<span style=\"color: #0000ff;\">07'30<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<h2><span id=\"Examples\">Examples<\/span><\/h2>\n<p class=\"intro-text\">Expression:\u00a0<span class=\"code-fragment\">String(True)<\/span><br \/>\nResult: Returns the Boolean value of <em>True<\/em> as a string value of \"True\". <br \/>\nE.g.\u00a0<span style=\"color: #0000ff;\">True<\/span><\/p>\n<p class=\"intro-text\">Expression: <span class=\"code-fragment\">String(12)<\/span><br \/>\nResult: Returns the integer value of <em>12<\/em>\u00a0as a string value of \"12\". <br \/>\nE.g. <span style=\"color: #0000ff;\">12<\/span><\/p>\n<p class=\"intro-text\">Expression: <span class=\"code-fragment\">String(12.2)<\/span><br \/>\nResult: Returns the decimal value of <em>12.2<\/em>\u00a0as a string value of \"12.2\". <br \/>\nE.g. <span style=\"color: #0000ff;\">12.2<\/span><\/p>\n<p class=\"intro-text\">Expression: <span class=\"code-fragment\">String(Time(), \"HH:MI:SS DD-MON-YYYY\")<\/span><br \/>\nResult: Format the time\u00a0as a string in the supplied format. <br \/>\nE.g. <span style=\"color: #0000ff;\">00:00:00 01-Jan-2016<\/span><\/p>\n<p class=\"intro-text\">Expression: <span class=\"code-fragment\">String({utc'2017-01-18 14:32'}, \"DD\/MM\/YY HH:MI:SS\")<\/span><br \/>\nResult: Format the supplied time in the specified format string. <br \/>\nE.g. <span style=\"color: #0000ff;\">18\/01\/17 14:32:00<\/span><\/p>\n<p class=\"intro-text\">Expression: <span class=\"code-fragment\">String({utc'2017-01-18 14:32'}, \"DDMMYYYY\")<\/span><br \/>\nResult: Format the supplied time as a date in the specified format string. <br \/>\nE.g. <span style=\"color: #0000ff;\">18012017<\/span><\/p>\n<p class=\"intro-text\">Expression: <span class=\"code-fragment\">String(DateTime(1232256720.0), \"DD\/MM\/YY HH24:MI:SS\")<\/span><br \/>\nResult: Format the supplied time in the specified format string. <br \/>\nE.g. <span style=\"color: #0000ff;\">18\/01\/17 14:32:00<\/span><\/p>\n<p class=\"intro-text\">Expression: <span class=\"code-fragment\">String({du'-01:02:03.456'}, \"HH:MI:SS:fffffff\")<\/span><br \/>\nResult: Format the supplied duration as a time in the specified format string. <br \/>\nE.g.\u00a0<span style=\"color: #0000ff;\">01:02:03:4560000<\/span><\/p>\n<h2><span id=\"Release_History\">Release History<\/span><\/h2>\n<ul class=\"intro-text\">\n<li>String() 4.6.5\n<ul class=\"intro-text\">\n<li>Changed Arg1 parameter to support MultiCollection values.<\/li>\n<\/ul>\n<\/li>\n<li>String() 4.0\n<ul class=\"intro-text\">\n<li>Initial version<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Converts the supplied argument into a String data type.<\/p>\n<p class=\"continue-reading-button\"> <a class=\"continue-reading-link\" href=\"https:\/\/oihelp.corporate.ifs.com\/help\/p2-server\/calculations\/string\/\">Read more<i class=\"crycon-right-dir\"><\/i><\/a><\/p>\n","protected":false},"author":1,"featured_media":10466,"parent":3650,"menu_order":206,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":"","_members_access_role":[],"_members_access_error":""},"categories":[9],"tags":[100,397],"class_list":["post-28180","page","type-page","status-publish","has-post-thumbnail","hentry","category-tech-ref","tag-calculations","tag-casting-functions","Version-4-0","Version-4-6-5","Product-srv"],"_links":{"self":[{"href":"https:\/\/oihelp.corporate.ifs.com\/help\/wp-json\/wp\/v2\/pages\/28180","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/oihelp.corporate.ifs.com\/help\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/oihelp.corporate.ifs.com\/help\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/oihelp.corporate.ifs.com\/help\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/oihelp.corporate.ifs.com\/help\/wp-json\/wp\/v2\/comments?post=28180"}],"version-history":[{"count":2,"href":"https:\/\/oihelp.corporate.ifs.com\/help\/wp-json\/wp\/v2\/pages\/28180\/revisions"}],"predecessor-version":[{"id":64774,"href":"https:\/\/oihelp.corporate.ifs.com\/help\/wp-json\/wp\/v2\/pages\/28180\/revisions\/64774"}],"up":[{"embeddable":true,"href":"https:\/\/oihelp.corporate.ifs.com\/help\/wp-json\/wp\/v2\/pages\/3650"}],"wp:attachment":[{"href":"https:\/\/oihelp.corporate.ifs.com\/help\/wp-json\/wp\/v2\/media?parent=28180"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/oihelp.corporate.ifs.com\/help\/wp-json\/wp\/v2\/categories?post=28180"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/oihelp.corporate.ifs.com\/help\/wp-json\/wp\/v2\/tags?post=28180"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}