The FORMATTER option is defined by the syntax provided within the .Net Framework. The syntax was created and is provided in such a way as to work as a culture specific syntax. All format tokens begin and end with a curly brace {...}. Utilization of the format element can be simplistic, or provide a compound and deterministic statement which is much more advanced. After reviewing the options provided, a more advanced format provides the ability to vary the format depending on the value of the data. For example
{0:$#,##0.00;($#,##0.00);Nothing}
This syntax is usefull in combination with the following tags:
- Format - [Format,Value,{FORMATTER}]
- Pre Format - [$Value,{FORMATTER}]
- COALESCE - [COALESCE,Value,Collection,{FORMATTER}]
The resulting output would be $1,234.50 if the data value was 1234.50. Or, ($1,234.50) if the value had been negative. If the item is zero, the output would result in Nothing.
|
Specifier
|
Type
|
FORMAT
|
Sample (1.2345)
|
Sample (-12345)
|
|
|
|
|
|
|
|
d
|
decimal
|
{0:d}
|
FormatException
|
-12345
|
|
e
|
exponent / scientific
|
{0:e}
|
1.234500e+000
|
-1.234500e+004
|
|
f
|
fixed point
|
{0:f}
|
1.23
|
-12345.00
|
|
g
|
general
|
{0:g}
|
1.2345
|
-12345
|
|
n
|
number
|
{0:n}
|
1.23
|
-12,345.00
|
|
r
|
round trippable
|
{0:r}
|
1.23
|
FormatException
|
|
x
|
hexadecimal
|
{0:x4}
|
FormatException
|
ffffcfc7
|
|
Specifier
|
Type
|
FORMAT
|
Sample (1234.56)
|
|
0
|
zero placeholder
|
{0:00.000}
|
1234.560
|
|
#
|
digit placeholder
|
{0:#.##}
|
1234.56
|
|
.
|
decimal point placeholder
|
{0:0.0}
|
1234.6
|
|
,
|
thousand separator
|
{0:0,0}
|
1,235
|
|
%
|
percentage
|
{0:0%}
|
123456
|
|
Specifier
|
Type
|
FORMAT
|
Sample (January 2, 3456 7:08:09 PM)
|
|
d
|
short date
|
{0:d}
|
1/2/3456
|
|
D
|
long date
|
{0:D}
|
Wednesday, January 2, 3456
|
|
t
|
short time
|
{0:t}
|
7:08 PM
|
|
T
|
long time
|
{0:T}
|
7:08:09 PM
|
|
f
|
full date/time
|
{0:f}
|
Wednesday, January 2, 3456 7:08 PM
|
|
F
|
long full date/time
|
{0:F}
|
Wednesday, January 2, 3456 7:08:09 PM
|
|
g
|
general
|
{0:g}
|
1/2/3456 7:08 PM
|
|
G
|
long general
|
{0:G}
|
1/2/3456 7:08:09 PM
|
|
M
|
day / month
|
{0:M}
|
January 1
|
|
r
|
RFC1123 date
|
{0:r}
|
Wed, 1 Jan 3456 19:08:09 GMT
|
|
s
|
sortable date/time
|
{0:s}
|
3456-01-02T19:08:09
|
|
u
|
universal
|
{0:u}
|
3456-01-02 19:08:09Z
|
|
Y
|
month/year
|
{0:Y}
|
January, 3456
|
|
Specifier
|
Type
|
FORMAT
|
Sample (January 2, 3456 7:08:09 PM)
|
|
dd
|
day
|
{0:dd}
|
02
|
|
ddd
|
short day
|
{0:ddd}
|
Wed
|
|
dddd
|
long day
|
{0:dddd}
|
Wednesday
|
|
hh
|
2 digit hour
|
{0:hh}
|
07
|
|
HH
|
2 digit hour
|
{0:HH}
|
19
|
|
mm
|
2 digit minute
|
{0:mm}
|
08
|
|
MM
|
month
|
{0:MM}
|
01
|
|
MMM
|
short month name
|
{0:MMM}
|
Jan
|
|
MMMM
|
long month name
|
{0:MMMM}
|
January
|
|
ss
|
seconds
|
{0:ss}
|
09
|
|
tt
|
am/pm
|
{0:tt}
|
PM
|
|
yy
|
2 digit year
|
{0:yy}
|
56
|
|
yyyy
|
4 digit year
|
{0:yyyy}
|
3456
|
|
:
|
separator
|
{0:hh:mm:ss}
|
07:08:09
|
|
/
|
separator
|
{0:dd/MM/yyyy}
|
01/02/3456
|
While the standard .Net formatters provide the ability to handle most any type of generic data type, and layout the data precisely how you want it to appear, it doesn’t provide the facility to enhance your abilities to format the data in an “as you see fit” scenario.
Open Web Studio provides an enhanced FORMAT library with a variety of additional values which are identified in the following list. These formatters provide simple tasks like specific Tab look-ups by the Name of the tab, through advanced dynamic look-ups against any specific table to encoding, decoding and runtime verifications.
Used to return only the first N characters from the value
Format:
[FORMAT,VALUE,{LEFT:LENGTH }]
Example:
[FORMAT,My Tab,{LEFT:2}]
Result:
My
Used to return only the last N characters from the value
Format:
[FORMAT,VALUE,{RIGHT:LENGTH }]
Example:
[FORMAT,My Tab,{RIGHT:2}]
Result:
ab
Used to return the characters from the middle of the value starting at character X and ending at character Y.
Format:
[FORMAT,VALUE,{MID:FROM,TO}]
Example:
[FORMAT,My Tab,{MID:3,5}]
Result:
Ta
Convert the entire value to upper case
Format:
[FORMAT,VALUE,{UPPER}]
Example:
[FORMAT,My Tab,{UPPER}]
Result:
MY TAB
Convert the entire value to lower case
Format:
[FORMAT,VALUE,{LOWER}]
Example:
[FORMAT,My Tab,{LOWER}]
Result:
my tab
Return the length of the value
Format:
[FORMAT,VALUE,{LENGTH}]
Example:
[FORMAT,My Tab,{LENGTH}]
Result:
6
Replace a specific character combination from the value with another. This can be used for any displayed or whitespace value. Additionally, special characters and symbols can be replaced by utilizing the char(#) syntax as the value for the LOOKFOR and/or the REPLACEWITH.
Format:
[FORMAT,VALUE,{REPLACE:LOOKFOR,REPLACEWITH}]
[FORMAT,VALUE,{REPLACE:char(LOOKFOR ASCII CODE),char(REPLACEWITH ASCII CODE)}]
Example:
[FORMAT,My Tab,{REPLACE:My,Our}]
[FORMAT,This is a 'test' value,{replace:char(39),---}]
[FORMAT,This is a 'test' value,{replace:char(39),char(34)}]
Result:
Our Tab
This is a ---test--- value
This is a "test" value
Add a specific character to the Left of the value to reach a specific length for the entire text
Format:
[FORMAT,VALUE,{PADLEFT:LENGTH,CHARACTER}]
Example:
[FORMAT,My Tab,{PADLEFT:10,#}]
Result:
####My Tab
Add a specific character to the Right of the value to reach a specific length
Format:
[FORMAT,VALUE,{PADRIGHT:LENGTH,CHARACTER}]
Example:
[FORMAT,My Tab,{PADRIGHT:10,#}]
Result:
My Tab####
Remove whitespace characters from the Left and Right of the value
Format:
[FORMAT,VALUE,{TRIM}]
Example:
([FORMAT,” My Tab ”,{TRIM}])
Result:
(My Tab)
Remove whitespace characters from the Left of the value
Format:
[FORMAT,VALUE,{TRIMLEFT}]
Example:
([FORMAT,” My Tab ”,{TRIMLEFT}])
Result:
(My Tab )
Remove whitespace characters from the Right of the value
Format:
[FORMAT,VALUE,{TRIMRIGHT}]
Example:
([FORMAT,” My Tab ”,{TRIMRIGHT}])
Result:
( My Tab)
Convert the value to a ANSI standard URI formatted value for query string pass through from a real ASCII value
Format:
[FORMAT,VALUE,{ENCODEURI}]
Example:
([FORMAT,”!@#$ %^&*()<>=&”,{ENCODEURI}])
Result:
!%40%23%24+++%25%5e%26*()%3c%3e%3d%26
Convert the value from the ANSI standard URI formatted query string value to a real ASCII value
Format:
[FORMAT,VALUE,{DECODEURI}]
Example:
([FORMAT,”!%40%23%24+++%25%5e%26*()%3c%3e%3d%26”,{DECODEURI}])
Result:
!@#$ %^&*()<>=&
Convert the ASCII value containing HTML formatting to a standard, non-HTML handled format. In real terms, replacing the HTML formatting with escaped HTML formatting, for example: ‘<’ becomes ‘<’.
Format:
[FORMAT,VALUE,{ENCODEHTML}]
Example:
([FORMAT,”<li>This is a test & it works</li>”,{ENCODEHTML}])
Result:
<li>This is a test & it works </li>
Convert the escaped HTML format with the true ASCII value, for example: ‘<’ becomes ‘<’.
Format:
[FORMAT,VALUE,{ DECODEHTML}]
Example:
([FORMAT,”<li>This is a test & it works </li>”,{DECODEHTML}])
Result:
<li>This is a test & it works</li>
Using any standard value, automatically replace
Wiki Syntax with the translated value. This is very useful for generic links, formatting and interaction for all types of data.
Format:
[FORMAT,VALUE,{ENCODEWIKI}]
Example:
([FORMAT,”[[Wiki|Wiki Syntax]]”,{ENCODEWIKI}])
Result:
<a href="?topic=Wiki">Wiki Syntax</a>
At times you may require the ability to Encrypt your value using a specific Key value for the encryption itself. To do this, use the Encrypt formatter with the desired Key as the parameter.
Format:
[FORMAT,VALUE,{ENCRYPT:KEY}]
Example:
([FORMAT,”<li>This is a test & it works</li>”,{ENCRYPT:12341253214321FA}])
Result:
JSFhfhiapfahpifwPIip2ip5fip%
At times you may require the ability to Decrypt your value using a specific Key value for the decryption itself. To do this, use the Decrypt formatter with the desired Key as the parameter.
Format:
[FORMAT,VALUE,{DECRYPT:KEY}]
Example:
([FORMAT,”JSFhfhiapfahpifwPIip2ip5fip%”,{DECRYPT:12341253214321FA}])
Result:
<li>This is a test & it works</li>
Evaluate the value to determine if the value is empty, having a length of zero. In which case, a default value can be utilized in its place.
Format:
[FORMAT,VALUE,{ISEMPTY:DEFAULT}]
Example:
([FORMAT,”My Tab”,{ISEMPTY:No Tab Name provided }])
([FORMAT,””,{ISEMPTY:No Tab Name provided }])
Result:
My Tab
No Tab Name provided
Returns a Boolean True or False value, identifying whether the current user is a member of a specific role (by name or id).
Note: Super Users are ALWAYS True in this scenario. Additionally, IsInRole supports a check if the user is in ANY of the roles specified by delimiting the Role Names with semicolon: Administrators;Registered Users;
Format:
[FORMAT,VALUE,{ISINROLE}]
Example:
([FORMAT,”Administrators”,{ISINROLE}])
Result:
True
Returns a Boolean True or False value, identifying whether the current user is a super user within the environment.
Format:
[FORMAT,,{ISSUPERUSER}]
Example:
([FORMAT,,{ISSUPERUSER}])
Result:
True
Example that checks if you are a "SUPER USER":
{IIF, "[FORMAT,,{ISSUPERUSER}]=True", "I AM A SUPER USER", "I AM NOT A SUPER USER"}
Returns a Boolean True or False value, identifying whether the value is a numeric format, or if it is a string value (non-numeric)
Format:
[FORMAT,VALUE,{ISNUMERIC}]
Example:
([FORMAT,”Not a Number”,{ISNUMERIC}])
([FORMAT,”12.435”,{ISNUMERIC}])
Result:
False
True
Returns a Boolean True or False value, identifying whether the value is a date format, or if it is a non date format.
Format:
[FORMAT,VALUE,{ISDATE}]
Example:
([FORMAT,”Not a Date”,{ISDATE}]) ([FORMAT,”12/4/1935”,{ISDATE}])
Result:
False True
Returns a Boolean True or False value, identifying whether the current user has been granted Edit access to the specific module.
Format:
[FORMAT, ,{CANEDIT}]
Example:
([FORMAT,,{CANEDIT}])
Result:
True
Identifies whether the value, evaluated as a file path, points to an existing file, or a non existing file. This value is returned as a Boolean True or False.
Format:
[FORMAT,VALUE,{EXISTS}]
Example:
([FORMAT,”C:/inetpub/item4/test.txt”,{EXISTS}])
([FORMAT,”~/images/xml.gif”,{EXISTS}])
Result:
True
True
Returning a Boolean True or False value, identifies whether the value begins with the designated character value. (NEW)
Format:
[FORMAT,VALUE,{STARTSWITH:SEARCH}]
Example:
([FORMAT,”My Tab”,{STARTSWITH:My}])
([FORMAT,”My Tab”,{STARTSWITH:Our}])
Result:
True
False
Returning True or False, identifies if the value ends with the designated value.
Format:
[FORMAT,VALUE,{ENDSWITH:SEARCH}]
Example:
([FORMAT,”My Tab”,{ENDSWITH:ab}])
([FORMAT,”My Tab”,{ENDSWITH:abs}])
Result:
True
False
Returns True or False, identifies whether the value contains the designated character value
Format:
[FORMAT,VALUE,{CONTAINS:SEARCH}]
Example:
([FORMAT,”My Tab”,{CONTAINS:ab}])
([FORMAT,”My Tab”,{CONTAINS:abs}])
Result:
True
False
Returns the first index (position) of the item for which you are searching within the string
Format:
[FORMAT,VALUE,{INDEXOF:SEARCH}]
Example:
([FORMAT,”My Tab”,{INDEXOF:ab}])
([FORMAT,”My Tab”,{INDEXOF:abs}])
Result:
4
-1
Returns the last index (position) of the item for which you are searching within the string
Format:
[FORMAT,VALUE,{INDEXOF:SEARCH}]
Example:
([FORMAT,”My Tab Tabs”,{LASTINDEXOF:ab}])
([FORMAT,”My Tab Tabs”,{LASTINDEXOF:abs}])
Result:
8
8
Replaces the provided Tab Name value with the associated TabID
Format:
[FORMAT,TABNAME,{TABID}]
Example:
[FORMAT,My Tab,{TABID}]
Result:
318
Replaces the provided value with the TabID based on a lookup on the provided Column name.
The Column provided within the syntax identifies which column is used as the lookup or search field within the Tabs table for the designated TabId. The result is always the First occurring value within the designated lookup. (NEW)
Format:
[FORMAT,VALUE,{TABID:COLUMN }]
Example:
[FORMAT,My Tab,{TABID:Title}]
Result:
318
Replaces the provided value with the TabName of the tab, given the specified TabId value.
Format:
[FORMAT,TABID,{TABNAME}]
Example:
[FORMAT,318,{TABNAME}]
Result:
My Tab
Replaces the provided value with the Title of the tab, given the specified TabId value.
Format:
[FORMAT,TABID,{TABTITLE}]
Example:
[FORMAT,318,{TABTITLE}]
Result:
My Tab
Replaces the provided value with the Description of the tab, given the specified TabId value.
Format:
[FORMAT,TABID,{TABDESCRIPTION}]
Example:
[FORMAT,318,{TABDESCRIPTION}]
Result:
My Tab – used for locating all my modules
Provides a rapid, integrated, and simple look-up ability against any of the provided tables within the database with a specified value contained in a specific column, and returns the value of the identified return column.
Look up any value within any table and return the first result identified quickly and easily.
Format:
[FORMAT,VALUE,{SQLFIND: TABLENAME, SEARCHCOLUMN, RESULTCOLUMN }]
Example:
[FORMAT,info@bi4ce.com,{SQLFIND:employee,email_address,employee_id}]
[FORMAT,Home,{SQLFIND:Tabs,Title,TabId}]
[FORMAT,Maryland,{SQLFIND:UserProfile,Value,UserID}]
Format:
[FORMAT,PATH,{FILE.VERSION}]
Format:
[FORMAT,PATH,{FILE.VERSION.MAJOR}]
Format:
[FORMAT,PATH,{FILE.VERSION.MINOR}]
Format:
[FORMAT,PATH,{FILE.VERSION.BUILD}]
Format:
[FORMAT,PATH,{FILE.VERSION.REVISION}]
Format:
[FORMAT,PATH,{FILE.VERSION.PRODUCT}]
Format:
[FORMAT,PATH,{FILE.VERSION.PRODUCT.MAJOR}]
Format:
[FORMAT,PATH,{FILE.VERSION.PRODUCT.MINOR}]
Format:
[FORMAT,PATH,{FILE.VERSION.PRODUCT.BUILD}]
Format:
[FORMAT,PATH,{FILE.VERSION.PRODUCT.REVISION}]
Format:
[FORMAT,PATH,{FILE.VERSION.NAME}]
Format:
[FORMAT,PATH,{FILE.VERSION.COMMENTS}]
Format:
[FORMAT,PATH,{FILE.VERSION.COMPANY}]
Returns True/False identifying whether the file is an Image.
Format:
[FORMAT,PATH,{FILE.IMAGE}]
Returns the width of the image in pixels
Format:
[FORMAT,PATH,{FILE.IMAGE.WIDTH}]
Returns the height of the image in pixels
Format:
[FORMAT,PATH,{FILE.IMAGE.HEIGHT}]
Format:
[FORMAT,PATH,{FILE.IMAGE.RAWFORMAT}]
Format:
[FORMAT,PATH,{FILE.IMAGE.HORIZONTALRESOLUTION}]
Format:
[FORMAT,PATH,{FILE.IMAGE.VERTICALRESOLUTION}]
Returns Width by Height as in 150x225
Format:
[FORMAT,PATH,{FILE.IMAGE.DIMENSIONS}]
Format:
[FORMAT,PATH,{FILE.EXISTS}]
Format:
[FORMAT,PATH,{FILE.FOLDER}]
Format:
[FORMAT,PATH,{FILE.PATH}]
Format:
[FORMAT,PATH,{FILE.NAME}]
Returns the Name without the extension
Format:
[FORMAT,PATH,{FILE.NAMEONLY}]
Format:
[FORMAT,PATH,{FILE.EXTENSION}]
Returns the entire text equivalent content of the file
Format:
[FORMAT,PATH,{FILE}]
Returns the entire byte array of the content in string format.
Format:
[FORMAT,PATH,{FILE.BYTES}]
Format:
[FORMAT,PATH,{FILE.LENGTH}]
Format:
[FORMAT,PATH,{FILE.SIZE}]
Format:
[FORMAT,PATH,{FILE.CREATED}]
Format:
[FORMAT,PATH,{FILE.UPDATED}]
Format:
[FORMAT,PATH,{FILE.ACCESSED}]