do
/ Conditionals / do
How to use do
- In some scenarios, we need to add do in some places.
- For example,
-
123[do.@a user_cannot="administrator" not_empty="{current_user.centre_name}"][aw2.get current_user.centre_name set="module.current_user_centre" /][/do.@a]
- Here, if current_user.centre_name is not empty and user is not “administrator”
- then set current_user_centre = current_user.centre_name
- In such many cases, do plays easy role as much than if condition.
- Let’s see some easy syntax’s of do condition.
-
123[do.@a <condition_case>="{value}"]//** code goes here **//[/do.@a]
- <condition_case> can be
- empty
- not_empty
- user_cannot
- user_can
- and any singular value comparative operator
- Example
-
12345[template.set data="hello" /][do.@a not_empty="{template.data}"][aw2.get template.data set="module.dataaaaa" /][/do.@a][aw2.get module dump=t /]
-
123[do.@a cond="{value}" <condition_case>="{value}"]//** code goes here **//[/do.@a]
- <condition_case> can be
- equal
- not_equal
- greater_equal
- greater_than
- less_equal
- less_than
- and any two valued comparative operator
- cond is value which is need to be compared
- Example
-
123456[template.set data1="1" /][template.set data2="2" /][do.@a cond="{template.data1}" less_than="{template.data2}"][aw2.get template.data2 set="module.value" /][/do.@a][aw2.get module dump=t /]
-
1234567[do.search]hello dolly[aw2.set search.x=hero /][aw2.set_array search.a x=1 y=2 z=3 /][aw2.get search.x /][aw2.get search.dump /][/do.search]
- This will out put as
- Please add your examples also, to update this as much as possible
- Happy coding!