{"id":8919,"date":"2021-06-10T17:46:00","date_gmt":"2021-06-10T10:46:00","guid":{"rendered":"https:\/\/tino.vn\/?post_type=ht_kb&#038;p=8919"},"modified":"2021-07-07T14:40:12","modified_gmt":"2021-07-07T07:40:12","slug":"workflows-su-dung-cac-bieu-thuc-trong-tham-so-hoat-dong","status":"publish","type":"ht_kb","link":"https:\/\/tino.vn\/blog\/docs\/workflows-su-dung-cac-bieu-thuc-trong-tham-so-hoat-dong\/","title":{"rendered":"[Workflows] S\u1eed d\u1ee5ng c\u00e1c bi\u1ec3u th\u1ee9c trong tham s\u1ed1 ho\u1ea1t \u0111\u1ed9ng"},"content":{"rendered":"<h1>S\u1eed d\u1ee5ng c\u00e1c bi\u1ec3u th\u1ee9c trong tham s\u1ed1 ho\u1ea1t \u0111\u1ed9ng<\/h1>\n<p>\u0110\u1ec3 mang l\u1ea1i t\u00ednh linh ho\u1ea1t t\u1ed1i \u0111a, c\u00e1c tham s\u1ed1 ho\u1ea1t \u0111\u1ed9ng cho ph\u00e9p s\u1eed d\u1ee5ng c\u00e1c bi\u1ec3u th\u1ee9c \u0111\u1eb7c bi\u1ec7t c\u00f3 gi\u00e1 tr\u1ecb \u0111\u01b0\u1ee3c t\u00ednh to\u00e1n t\u1ea1i th\u1eddi gian ch\u1ea1y. \u0110\u1ec3 ch\u1ec9 \u0111\u1ecbnh r\u1eb1ng gi\u00e1 tr\u1ecb tham s\u1ed1 l\u00e0 m\u1ed9t bi\u1ec3u th\u1ee9c, h\u00e3y s\u1eed d\u1ee5ng k\u00fd hi\u1ec7u gi\u1ed1ng Excel \u2013 ngh\u0129a l\u00e0 b\u1eaft \u0111\u1ea7u gi\u00e1 tr\u1ecb b\u1eb1ng d\u1ea5u \u201cb\u1eb1ng\u201d: <code> = <\/code>. N\u00f3i c\u00e1ch kh\u00e1c: <em> m\u1ed9t bi\u1ec3u th\u1ee9c l\u00e0 b\u1ea5t k\u1ef3 th\u1ee9 g\u00ec \u0111\u01b0\u1ee3c th\u00eam v\u00e0o tr\u01b0\u1edbc b\u1eb1ng m\u1ed9t d\u1ea5u b\u1eb1ng <\/em>.<\/p>\n<p><strong> V\u00ed d\u1ee5: <\/strong><\/p>\n<p><code>=6^2 + {=Document:PROPERTY_NUM}\/2<\/code><\/p>\n<p><code>=if({Document:ID}=5, \"text1\", \"text2\")<\/code><\/p>\n<p>M\u1ed9t tham s\u1ed1 ch\u1ec9 c\u00f3 th\u1ec3 s\u1eed d\u1ee5ng m\u1ed9t bi\u1ec3u th\u1ee9c. \u0110\u1ec3 s\u1eed d\u1ee5ng nhi\u1ec1u bi\u1ec3u th\u1ee9c trong m\u1ed9t tham s\u1ed1, h\u00e3y s\u1eed d\u1ee5ng to\u00e1n t\u1eed n\u1ed1i (&amp;) v\u00e0 \u0111\u1eb7t v\u0103n b\u1ea3n trong bi\u1ec3u th\u1ee9c trong d\u1ea5u ngo\u1eb7c k\u00e9p (<code>\"<\/code>) n\u1ebfu c\u1ea7n.<\/p>\n<p><strong> V\u00ed d\u1ee5 : <\/strong><\/p>\n<p><code>=\"Reply:\" &amp; (1+3)<\/code><\/p>\n<p><code>=\"Author: \" &amp; {=Document:CREATED_BY} &amp; \", \" &amp; \"Deadline: \" &amp; Dateadd({=Document:DATE_CREATE}, \"1d\")<\/code><\/p>\n<p><img decoding=\"async\" class=\"alignnone wp-image-7210 size-full\" src=\"https:\/\/academy.younetsi.com\/wp-content\/uploads\/2021\/03\/action_parameters.png\" sizes=\"(max-width: 625px) 100vw, 625px\" srcset=\"https:\/\/academy.younetsi.com\/wp-content\/uploads\/2021\/03\/action_parameters.png 625w, https:\/\/academy.younetsi.com\/wp-content\/uploads\/2021\/03\/action_parameters-300x157.png 300w\" alt=\"\" width=\"625\" height=\"328\" title=\"\"><\/p>\n<p>Nh\u01b0 b\u1ea1n s\u1ebd th\u1ea5y b\u00ean d\u01b0\u1edbi, c\u00fa ph\u00e1p c\u1ee7a c\u00e1c to\u00e1n t\u1eed v\u00e0 h\u00e0m trong bi\u1ec3u th\u1ee9c ph\u1ea7n l\u1edbn d\u1ef1a tr\u00ean c\u00fa ph\u00e1p c\u1ee7a c\u00e1c<\/p>\n<p>to\u00e1n t\u1eed v\u00e0 h\u00e0m trong PHP. C\u00f3 th\u1ec3 s\u1eed d\u1ee5ng c\u00e1c to\u00e1n t\u1eed v\u00e0 h\u00e0m sau.<\/p>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li><strong> + <\/strong> \u2013 th\u00eam hai gi\u00e1 tr\u1ecb;<\/li>\n<li><strong> \u2013 <\/strong> \u2013 tr\u1eeb gi\u00e1 tr\u1ecb th\u1ee9 hai v\u1edbi gi\u00e1 tr\u1ecb \u0111\u1ea7u ti\u00ean;<\/li>\n<li><strong> * <\/strong> \u2013 nh\u00e2n hai gi\u00e1 tr\u1ecb;<\/li>\n<li><strong>\/<\/strong> \u2013 chia gi\u00e1 tr\u1ecb \u0111\u1ea7u ti\u00ean cho gi\u00e1 tr\u1ecb th\u1ee9 hai;<\/li>\n<li><strong> = <\/strong> \u2013 g\u00e1n (t\u1ee9c l\u00e0 tr\u1ea3 v\u1ec1) bi\u1ec3u th\u1ee9c k\u1ebft qu\u1ea3;<\/li>\n<li><strong>&lt;&gt; <\/strong>\u2013 kh\u00f4ng b\u1eb1ng;<\/li>\n<li><strong>&lt; <\/strong>\u2013 \u00edt h\u01a1n;<\/li>\n<li><strong>&gt; <\/strong>\u2013 nhi\u1ec1u h\u01a1n;<\/li>\n<li><strong>&lt;= <\/strong> \u2013 nh\u1ecf h\u01a1n ho\u1eb7c b\u1eb1ng;<\/li>\n<li><strong>&gt;= <\/strong> \u2013 nhi\u1ec1u h\u01a1n ho\u1eb7c b\u1eb1ng;<\/li>\n<li><strong> () <\/strong> \u2013 d\u1ea5u ngo\u1eb7c tr\u00f2n;<\/li>\n<li><strong> &amp; <\/strong>\u2013 to\u00e1n t\u1eed n\u1ed1i. Tr\u1ea3 v\u1ec1 m\u1ed9t chu\u1ed7i m\u1edbi l\u00e0 chu\u1ed7i b\u00ean tr\u00e1i c\u1ed9ng v\u1edbi chu\u1ed7i b\u00ean ph\u1ea3i;<\/li>\n<li><strong> ^ <\/strong> \u2013 power;<\/li>\n<li><strong>% <\/strong> \u2013 ph\u1ea7n tr\u0103m;<\/li>\n<li><strong> true <\/strong> \u2013 Boolean <em> true <\/em>;<\/li>\n<li><strong> false <\/strong> \u2013 Boolean <em> false <\/em>;<\/li>\n<li><strong><b>and<\/b>&nbsp;<\/strong>\u2013 Boolean V\u00c0;<\/li>\n<li><strong>or&nbsp;<\/strong>\u2013 Boolean OR;<\/li>\n<li><strong> not <\/strong> \u2013 Boolean NOT;<\/li>\n<li><strong> min <\/strong> \u2013 tr\u1ea3 v\u1ec1 gi\u00e1 tr\u1ecb nh\u1ecf nh\u1ea5t trong hai gi\u00e1 tr\u1ecb;<\/li>\n<li><strong> abs <\/strong> \u2013 tr\u1ea3 v\u1ec1 gi\u00e1 tr\u1ecb tuy\u1ec7t \u0111\u1ed1i c\u1ee7a m\u1ed9t \u0111\u1ed1i s\u1ed1;<\/li>\n<li><strong> dateadd <\/strong> \u2013 th\u00eam kho\u1ea3ng th\u1eddi gian \u0111\u01b0\u1ee3c truy\u1ec1n l\u00e0m \u0111\u1ed1i s\u1ed1 th\u1ee9 hai v\u00e0o ng\u00e0y \u0111\u01b0\u1ee3c ch\u1ec9 \u0111\u1ecbnh l\u00e0m \u0111\u1ed1i s\u1ed1 \u0111\u1ea7u ti\u00ean.C\u00fa ph\u00e1p:<code> = dateadd ([ng\u00e0y ban \u0111\u1ea7u], [kho\u1ea3ng th\u1eddi gian]) <\/code>C\u00f3 th\u1ec3 s\u1eed d\u1ee5ng c\u00e1c \u0111\u01a1n v\u1ecb sau trong kho\u1ea3ng th\u1eddi gian: <code> y <\/code>, <code> year <\/code>, <code> n\u0103m <\/code>, <code> m <\/code>, <code> th\u00e1ng <\/code>, <code> th\u00e1ng <\/code>, <code> d <\/code>, <code> day <\/code>, <code> days <\/code>,<br \/>\n<code> h <\/code>, <code> hours <\/code>, <code> hours <\/code>, <code> i <\/code>, &lt;m\u00e3&gt; ph\u00fat , <code> ph\u00fat <\/code>, <code> ph\u00fat <\/code>, <code> s <\/code>, <code> gi\u00e2y <\/code>, <code> gi\u00e2y <\/code>&lt;\/m\u00e3&gt;<code>. C\u00e1c \u0111\u01a1n v\u1ecb kh\u00f4ng ph\u00e2n bi\u1ec7t ch\u1eef hoa ch\u1eef th\u01b0\u1eddng. <\/code><\/p>\n<p><code><code><\/code><\/code>V\u00ed d\u1ee5:<\/p>\n<p><code><code><\/code><\/code><code> = Dateadd ({= Document: DATE_CREATE}, \"-2ng\u00e0y\") <\/code><\/p>\n<p><code><code><\/code><\/code><code> = Dateadd ({= Document: DATE_CREATE}, \"2 ng\u00e0y 3 ph\u00fat\") <\/code><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><code><\/code><\/p>\n<ul>\n<li><code><code><strong> dateiff <\/strong> - Tr\u1ea3 v\u1ec1 <a href=\"http:\/\/php.net\/manual\/en\/datetime.diff.php\" rel=\"nofollow noopener\" target=\"_blank\"> s\u1ef1 kh\u00e1c bi\u1ec7t gi\u1eefa <\/a> hai ng\u00e0y.<\/code><\/code>C\u00fa ph\u00e1p:<code><code><\/code><\/code><code> = dateiff ([date1], [date2], [difference_display_format]) <\/code>;<code><code><\/code><\/code>S\u1ef1 kh\u00e1c bi\u1ec7t c\u00f3 th\u1ec3 \u0111\u01b0\u1ee3c hi\u1ec3n th\u1ecb trong <a href=\"http:\/\/php.net\/manual\/vi\/dateinterval.format.php\" rel=\"nofollow noopener\" target=\"_blank\"> c\u00e1c \u0111\u01a1n v\u1ecb kh\u00e1c nhau <\/a>.<code><code><\/code><\/code>V\u00ed d\u1ee5: <code> = dateiff ({= Variable: Variable1}, {= Variable: Variable2}, '% m th\u00e1ng,% d ng\u00e0y') <\/code><\/li>\n<li><code><code><strong> if <\/strong> - ch\u1ec9 \u0111\u1ecbnh m\u1ed9t \u0111i\u1ec1u ki\u1ec7n;<\/code><\/code>C\u00fa ph\u00e1p:<code><code><\/code><\/code><code> = if ([condition], [bi\u1ec3u th\u1ee9c n\u1ebfu \u0111\u00fang], [bi\u1ec3u th\u1ee9c n\u1ebfu sai]) <\/code><code><code><\/code><\/code>V\u00ed d\u1ee5:<code><code><\/code><\/code><code> = if ({= Variable: Variable1_printable} &amp; gt; 0, \"yes\", \"no\") <\/code><\/li>\n<li><code><code><strong> intval <\/strong> - tr\u1ea3 v\u1ec1 s\u1ed1 nguy\u00ean c\u1ee7a gi\u00e1 tr\u1ecb \u0111\u01b0\u1ee3c truy\u1ec1n d\u01b0\u1edbi d\u1ea1ng tham s\u1ed1;<\/code><\/code>V\u00ed d\u1ee5:<code><code><\/code><\/code><code> = intval (\"234j4hv5jhv43v53jk4vt5hj4\") <\/code> tr\u1ea3 v\u1ec1 234 v\u00ec gi\u00e1 tr\u1ecb b\u1eaft \u0111\u1ea7u b\u1eb1ng s\u1ed1 n\u00e0y v\u00e0 k\u00fd t\u1ef1 ngay sau \u201c4\u201d kh\u00f4ng ph\u1ea3i l\u00e0 s\u1ed1.<\/li>\n<li><code><strong> substr <\/strong> - tr\u1ea3 v\u1ec1 m\u1ed9t ph\u1ea7n c\u1ee7a chu\u1ed7i nh\u01b0 \u0111\u01b0\u1ee3c ch\u1ec9 \u0111\u1ecbnh b\u1edfi hai tham s\u1ed1 cu\u1ed1i c\u00f9ng. Xem <a href=\"http:\/\/www.php.net\/manual\/en\/ Ch\u1ee9c n\u0103ng.substr.php\" rel=\"nofollow noopener\" target=\"_blank\"> http:\/\/www.php.net\/manual\/en\/ Ch\u1ee9c n\u0103ng.substr.php <\/a> \u0111\u1ec3 bi\u1ebft chi ti\u1ebft.<\/code><\/li>\n<\/ul>\n<p><code><code><\/code><\/code><\/p>\n<p><strong> Ch\u00fa \u00fd! <\/strong> N\u1ebfu m\u1ed9t bi\u1ec3u th\u1ee9c c\u00f3 l\u1ed7i, bi\u1ec3u th\u1ee9c \u0111\u00f3 s\u1ebd kh\u00f4ng \u0111\u01b0\u1ee3c \u0111\u00e1nh gi\u00e1 v\u00e0 s\u1ebd \u0111\u01b0\u1ee3c hi\u1ec3n th\u1ecb d\u01b0\u1edbi d\u1ea1ng v\u0103n b\u1ea3n.<\/p>\n<p><code><code><\/code><\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>S\u1eed d\u1ee5ng c\u00e1c bi\u1ec3u th\u1ee9c trong tham s\u1ed1 ho\u1ea1t \u0111\u1ed9ng \u0110\u1ec3 mang l\u1ea1i t\u00ednh linh ho\u1ea1t t\u1ed1i \u0111a, c\u00e1c tham s\u1ed1 ho\u1ea1t \u0111\u1ed9ng cho ph\u00e9p s\u1eed d\u1ee5ng c\u00e1c bi\u1ec3u th\u1ee9c \u0111\u1eb7c bi\u1ec7t c\u00f3 gi\u00e1 tr\u1ecb \u0111\u01b0\u1ee3c t\u00ednh to\u00e1n t\u1ea1i th\u1eddi gian ch\u1ea1y. \u0110\u1ec3 ch\u1ec9 \u0111\u1ecbnh r\u1eb1ng gi\u00e1 tr\u1ecb tham s\u1ed1 l\u00e0 m\u1ed9t bi\u1ec3u th\u1ee9c, h\u00e3y [&hellip;]<\/p>\n","protected":false},"author":11,"featured_media":16424,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","format":"standard","meta":{"footnotes":""},"tags":[],"ht_kb_category":[5229],"class_list":["post-8919","ht_kb","type-ht_kb","status-publish","format-standard","has-post-thumbnail","hentry","ht_kb_category-workflows"],"_links":{"self":[{"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/ht_kb\/8919","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/ht_kb"}],"about":[{"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/users\/11"}],"replies":[{"embeddable":true,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/comments?post=8919"}],"version-history":[{"count":0,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/ht_kb\/8919\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/media\/16424"}],"wp:attachment":[{"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/media?parent=8919"}],"wp:term":[{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/tags?post=8919"},{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/ht_kb_category?post=8919"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}