This post is about the tips of Action tool in the Interface category.
The Action tool has some option at the Action Type. The screenshot is as follows.
This option will appear differently depending on the tools connected to the Action tool. In genellary, the following three actions will always appear in all cases as I know.
- Update Value with Formula
- Update Raw XML with Formula
- Update Value
I recommend that you should only use the “Update Raw XML with Formula” when you are in the complex cases. In other words, if you can’t do what you want using another 2 option, it’s better to use the “Update Raw XML with Formula” option.
At this post, I would like to explain two options “Update Value with Formula” and “Update Value”.
Explanation of each option
Let’s see a simple workflow. The sample analytic app is that you can change the tax freely.
The setting of the Formula tool is as follows.
If you want to change the value 1.0 at the Numeric Up Down tool, you set the setting to the Action tool below.
This setting is the same not depending on the action type.
Update Value
This option is rewriting the specific value by the data comming from the interface tool. So, you can set the setting below to rewrite the value “1.0” at the Action tool.
According to the screenshot, check the “Replace a specific string” and put the value “1.0” to the text box. This setting will rewrite the value “1.0” when the workflow running.
For example, if the tax is 10%, it is needed to rewrite it as 1.1. So you need to enter 1.1 as follows at the analytic app.
Point to keep in mind
You sometimes rewrite the expression of the Formula tool for debugging. For example, suppose you rewrite from 1.0 to 1.1.
If you use the option “Update Value”, you have to change the setting of the Action tool because the Action tool “Replace a specific string” is still previous value. In this case, you need to change the value 1.0 to 1.1.
This is careful point. If you forget the rewriting the “Replace a specific string”, the workflow won’t work.
In this case, it is better to use “Update Value with Formula” option than “Update Value” one. Because you don’t need to change the Action tool’s setting when you change the tool setting which the Action tool rewrites.
Of course, if you don’t use the “Replace a specific string”, it is no problem to use the “Update Value” option.
Update Value with Formula
Next, let’s see the “Upate Value with Formula” option. At this option, the string which the expression makes rewrites the specific whole value string.
When you select this option, the configuration window will change as follows.
According to the screenshot, if you change the action type from “Update Value” to “Update Value with Formula”, the “Replace a specific string” option becomes the place to enter the formula.
Let’s see the sample workflow. If you click on the three dots button on the right hand of the “Formula” text box, the Edit Formula dialogue will launch as follows.
On this dialogue, you need to write the formula on Expression text box. And the Action tool rewrite the other connected tool setting using the string which this expression make.
First, I write the expression “[Price]*1.0” which I wrote the Formula tool.
In this case, it shows error. [Price]*1.0 is expression, but the string is needed for rewriting. So let’s put the espression in quotes.
It doesn’t show the error. However, if you do this, the result is always to multiply the price by 1.0. This is not what I want. In this case, you can use the part of #1 on Variables tab.
#1 is the data which is coming to the Action tool. This time, the Numeric Up Down tool and Action tool are connecting. So, #1 is the data from the Numeric Up Down tool.
Here, we want to rewrite the “1.0”, so we can replace it to [#1].
'[Price]*'+[#1]
This option rewrites the whole string by what you make the expression using formula. So you don’t need to concern the connected tool’s setting.
Summary
- I explained the best practice to use the action tool to rewrite the value.
- When you want to rewrite the whole item, it is easy to use the “Update Value” option.
- On the other hand, when you want to rewrite a part of the string, it is better to use the “Update Value with Formula” option because it would be prevent from the mistakes.
Sample Workflow Download
Contents of the next blog
The next post will be about List Box tool.
コメント