-
Notifications
You must be signed in to change notification settings - Fork 0
/
producer.robot
49 lines (36 loc) · 1.55 KB
/
producer.robot
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
*** Settings ***
Documentation Robot Framework template implementing a Producer-Consumer model using
... custom libraries and resources. (Producer robot which produces output work)
Library DummyLibrary
Library RPA.FileSystem
Library RPA.Robocorp.WorkItems
Resource keywords.robot
Variables variables.py
*** Keywords ***
Log And Return Today
[Documentation] Logs today's date with both the RF and Python keywords, then
... returns today's date from the set variable.
Log Today In RF
Log Today In Python
RETURN ${TODAY}
*** Tasks ***
Produce Output
[Documentation] Read input data from the initial Work Item and create as many
... output Work Items for the 2nd Step as instructed to.
# Prepare the output Work Item data.
${message} = Get Work Item Variable message
${today} = Log And Return Today
${output_data} = Set Variable ${message} (${today})
# Read how many output Work Items to create from the input `count` field.
${count} = Get Work Item Variable count
FOR ${index} IN RANGE ${1} ${count + 1}
Log To Console Creating output item no. #${index}...
Create Output Work Item
Set Work Item Variable data ${index}. ${output_data}
${file_available} = Does File Exist ${WORKITEM_FILE_PATH}
IF ${file_available}
Add Work Item File ${WORKITEM_FILE_PATH}
END
Save Work Item
END
Log To Console Done with creating ${count} output Work Items for consuming!