BulePrism进阶教程-4. Input & Output

Referring back to the Circular Path Exercises Process, the limitation of the circuit on Page 1 is that it will do the same number of cycles both times. It would be useful if the Main Page could tell Page 1 how many cycles to perform, then the Main Page could use Page 1 to do any number of iterations.
This can be achieved by “telling” each reference to Page 1 the number of iterations required. This information is known as an Input Parameter, or Input for short.

Exercise 4.1.1 Page Inputs
In this exercise, we will add an input to Page 1 of the Circular Path Exercises Process.
 Go to Page 1 and open the Start stage properties window.
 Look at the empty inputs list and try to add a new input parameter.
 Tip: Notice that the right-hand column is named Store In. We have seen something similar before on the properties window of the Calculation stage.

Figure 34: Start Properties
 Press the Add button to create a row in the Inputs table.
 Enter the Number of Iterations in the Name field.
 The Description field is optional, but its good practice to provide additional detail, e.g., “The number of iterations to be performed - must be zero or greater”.
 Locate the Data Item Maximum Loops from the right-hand tree (under Numbers) and drag Maximum Loops into the “Store In” column.
 Notice how the Data Type is automatically set to that of the Data Item (i.e., Number).
 Close the Start properties window.

Exercise 4.1.2 Inputs and Page References
Now we have set up an Input Parameter on Page 1, we’ll look how that has affected the Page Reference on the Main Page of the Circular Path Exercises Process.
 Go to the Main Page and open the properties of the Page Reference stage.
 Notice that the Inputs tab has a new row on it, and that the Value field is empty

Figure 35: Page Reference Properties
 Press the Expression Editor button, , in the Value column to see a familiar-looking screen appear.

Figure 36: Expression Chooser Screen
 The Expression Chooser screen appears because the value for an input is supplied as an expression.
 Close the Expression Chooser screen and enter 2 in the Value field.
 Tip: You don’t have to open the Expression Chooser – you can enter the expression directly into the Value field.
 Open the second Page Reference and set it’s input value to 3.
 Press “Reset” and “Go”.
 Notice how the Page Reference stages each transmit their values to the Start stage on Page 1. The Start stage then sets the current value of the Data Item specified in the “Store In” column.
Key Point

As well as being used to sub-divide and organize a diagram, pages can also be used to make reusable functionality.


The Input Value used by the Page Reference stage is calculated from an expression and, as we have seen, an expression can use the values from Data Items.
Exercise 4.1.3 Input Values from Data Items
In this exercise, we will use Data Items instead of numbers typed directly into a Page Reference stage. So continuing with the Circular Path Exercises Process, follow these steps:
 Delete one of the Page Reference stages from Main Page and link the remaining Page Reference to the End stage.
 Add a new Data Item named Number of Iterations with data type Number and initial value 4.
 As well as being used to sub-divide and organize a diagram, pages can also be used

 Open the Page Reference properties and remove the expression in the Value field.
 Use the Data Item in a new expression, either by dragging the Data Item in from the right or by typing it in, i.e., [Number of Iterations].
 Press “Reset” and “Go”.
 Notice how the value of the Data Item on Main Page is transmitted by the Page Reference via the Start stage to the Data Item on Page 1.
 Save the Circular Path Exercises Process.
Key Point

 An input value is supplied as an expression.
 Usually this expression will simple (e.g., the name of a Data Item like [Full Name]) but could be more complex (e.g., [Forename] &“ “& [Middle Name] & “ “ & [Surname]).

4.2. Stepping and Pages
We have seen that we can step through a diagram one stage at a time. We can also use Step Over and Step Out to traverse pages more quickly.
Exercise 4.2.1 Step Over
In this exercise, we’ll see how Step Over can be used to execute a whole page in one go. So, within the Circular Path Exercises Process, follow these steps:
 Change the initial value of the Number of Iterations Data Item to 100.
 Reset and step forward once, either by using the Step button, , or by pressing F11.
 Tip: The Tools and Debug menus show you some o

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值