Examples of Common EL Expressions
This section describes common EL expressions and examples.
Method |
Description |
Example |
---|---|---|
String getNodeStatus(String nodeName) |
Obtains the running status of a specified node. If the node runs properly, success is returned. If the node fails to run, fail is returned. For example, to check whether a node is running successfully, you can use the following command, where test indicates the node name: #{(Job.getNodeStatus("test")) == "success" } |
Obtains the running status of the test node: #{Job.getNodeStatus("test")} |
String getNodeOutput(String nodeName) |
Obtains the output of a specified node. This method can only obtain the output of the previous dependent node. |
|
String getParam(String key) |
Obtains job parameters. This method only obtains the parameter values configured for the current job, but not parameter values passed from the parent job or the global variables configured for the workspace. To obtain the parameter values passed from the parent job and the global variables configured for the workspace, you are advised to use the ${job_param_name} expression. |
Obtains the value of the test parameter: #{Job.getParam("test")} |
String getPlanTime(String pattern) |
Obtains the plan time character string in a specified pattern. Pattern indicates the date and time mode. For details, see Date and Time Mode. |
Obtains the planned job scheduling time, which is accurate to millisecond: #{Job.getPlanTime("yyyy-MM-dd HH:mm:ss:SSS")} |
String getYesterday(String pattern) |
Obtains the time character string of the day before the plan time. Pattern indicates the date and time mode. For details, see Date and Time Mode. |
Obtains the time on the previous day of the planned job scheduling time, which is accurate to date: #{Job.getYesterday("yyyy-MM-dd HH:mm:ss:SSS")} |
String getLastHour(String pattern) |
Obtains the time character string of last hour before the plan time. Pattern indicates the date and time mode. For details, see Date and Time Mode. |
Obtains the time one hour before the planned job scheduling time, which is accurate to hour: #{Job.getLastHour("yyyy-MM-dd HH:mm:ss:SSS")} |
Date addDays(Date date, int amount) |
After the specified number of days is added to Date, the new Date object is returned. The amount can be a negative number. |
Subtracts one day from the planned job scheduling time and convert the time to the yyyy-MM-dd format. #{DateUtil.format(DateUtil.addDays(Job.planTime,-1),"yyyy-MM-dd")} |
int getDay(Date date) |
Obtains the day from the date. For example, if the date is 2018-09-14, 14 is returned. |
Obtain the day from the job scheduling plan. #{DateUtil.getDay(Job.planTime)} |
Date now() |
Returns the current time. |
Return the current time accurate to second. #{DateUtil.format(DateUtil.now(),"yyyy-MM-dd HH:mm:ss")} |
Object path(String jsonStr,String jsonPath) |
Returns the field value in a path specified by the JSON character string. This method is similar to XPath and can be used to retrieve or set JSON by path. You can use . or [] in the path to access members and values. For example, tables[0].table_name. |
The content of variable str is as follows:
{ "cities": [{ "name": "city1", "areaCode": "1000" }, { "name": "city2", "areaCode": "2000" }, { "name": "city3", "areaCode": "3000" }] }
The expression for obtaining the area code of city1 is as follows:
#{JSONUtil.path(str,"cities[0].areaCode")} |
current |
For Each nodes process data in a dataset by row. Loop.current indicates a row of a two-dimensional array defined in the dataset of the For Each node. This row is a one-dimensional array. Generally, the format is similar to #{Loop.current[0]}, #{Loop.current[1]}, or others. [0] indicates the first value in the current row, [1] indicates the second value in the current row, and so on. |
The value of Subjob Parameter for the For Each node indicates that the second value in the traversed row of the two-dimensional array in the dataset is always used in the loop traversal of the For Each node. #{Loop.current[1]} |
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot