(Created page with "<div style="float:right; clear:both; margin-left:0.5em;">__TOC__</div> <span STYLE="font-size: xx-large"><code>gn:act_setFormat</code></span> Category:Action_Library ;Des...") |
|||
(5 intermediate revisions by 2 users not shown) | |||
Line 4: | Line 4: | ||
;Description: Action used to set format to a target when the target is printed out as string. | ;Description: Action used to set format to a target when the target is printed out as string. | ||
− | :i.e. [[gn:act_sendEmail]] converts values to string values before sending them via email. If we would like to send gps location in some url and not as raw value then we would format the target which holds gps before using email action. | + | :i.e. <code>[[gn:act_sendEmail]]</code> converts values to string values before sending them via email. If we would like to send gps location in some url and not as raw value then we would format the target which holds gps before using email action. |
− | ;Action returns: | + | ;Action returns: void |
==Action signatures== | ==Action signatures== | ||
Line 31: | Line 31: | ||
* Valid formats: | * Valid formats: | ||
** <code>default</code> keyword. If set the format will be reset to internal default format. | ** <code>default</code> keyword. If set the format will be reset to internal default format. | ||
− | + | :* for <code>[[Datatypes#email|email]]</code> use formatting [https://docs.oracle.com/javase/8/docs/api/java/util/Formatter.html rules] | |
− | + | ::default format: <code>%1$s : %2$s</code> (name,email) | |
− | + | :* for <code>[[Datatypes#GPS|GPS]]</code> use formatting [https://docs.oracle.com/javase/8/docs/api/java/util/Formatter.html rules] | |
− | ** for <code>[[Datatypes#phoneNumber| | + | ::default format: <code>%1$s:%2$s</code> (latitude,longitude) |
+ | :* for <code>[[Datatypes#number|number]]</code> use formatting [https://docs.oracle.com/javase/7/docs/api/java/text/DecimalFormat.html rules] | ||
+ | ::default format: <code>0.00</code> | ||
+ | :* for <code>[[Datatypes#phoneNumber|phoneNumber]]</code> use formatting [https://docs.oracle.com/javase/8/docs/api/java/util/Formatter.html rules] | ||
+ | ::default format: <code>%1$s : %2$s : %3$s</code> (name,info,phonenumber) | ||
+ | :* for <code>[[Datatypes#phoneNumber|banking]]</code> use formatting [https://docs.oracle.com/javase/8/docs/api/java/util/Formatter.html rules] | ||
+ | ::default format: <code>%1$s : %2$s : %3$s</code> (IBAN,BIC,bank) | ||
|} | |} | ||
Line 40: | Line 46: | ||
=====initial format===== | =====initial format===== | ||
− | :<code>@variable/medicalAlert_phone_serialNumber</code> = <code>0.00</code> | + | ::<code>@variable/medicalAlert_phone_serialNumber</code> = <code>0.00</code> |
=====initial value outputed as string===== | =====initial value outputed as string===== | ||
− | <code>273743762924508.00</code> | + | ::<code>273743762924508.00</code> |
=====variables.xml===== | =====variables.xml===== | ||
Line 66: | Line 72: | ||
=====after action execution format===== | =====after action execution format===== | ||
− | :<code>@variable/medicalAlert_phone_serialNumber</code> = <code>#</code> | + | ::<code>@variable/medicalAlert_phone_serialNumber</code> = <code>#</code> |
=====after action execution value outputed as string===== | =====after action execution value outputed as string===== | ||
− | <code>273743762924508</code> | + | ::<code>273743762924508</code> |
<hr> | <hr> |
Latest revision as of 11:16, 7 May 2018
gn:act_setFormat
- Description
- Action used to set format to a target when the target is printed out as string.
- i.e.
gn:act_sendEmail
converts values to string values before sending them via email. If we would like to send gps location in some url and not as raw value then we would format the target which holds gps before using email action.
- Action returns
- void
Action signatures
[gn:act_setFormat]|[target, format]
Parameter Description target
target target to which format will be set. - Valid target:
format
format
Format which will be set on target. Format needs to be stored into a text datatype or a string resource.- Valid source:
- Valid formats:
default
keyword. If set the format will be reset to internal default format.
-
- default format:
%1$s : %2$s
(name,email)
- default format:
%1$s:%2$s
(latitude,longitude)
- default format:
0.00
- for
phoneNumber
use formatting rules
- default format:
%1$s : %2$s : %3$s
(name,info,phonenumber)
- default format:
%1$s : %2$s : %3$s
(IBAN,BIC,bank)
- default format:
Example
initial format
@variable/medicalAlert_phone_serialNumber
=0.00
initial value outputed as string
273743762924508.00
variables.xml
<variable id="medicalAlert_phone_serialNumber" type="number" defaultValue=""></variable>
strings.xml
<string name="formatNumber">#</string>
screen.xml
<FrameLayout android:id="@+id/exampleFrame" android:layout_width="wrap_content" android:layout_height="wrap_content" android:visibility="gone" gn:act_set="[gn:act_setFormat]|[@variable/medicalAlert_phone_serialNumber,@string/formatNumber];" />
after action execution format
@variable/medicalAlert_phone_serialNumber
=#
after action execution value outputed as string
273743762924508