Hi,
I was testing some expressions and found some problems.
Below in the example is a concurrent-iterator expression.
I get the following errors:
ruby SubProcessTest.rb SubProcessTest.rb:58: syntax error, unexpected
tSYMBEG, expecting kDO or '{' or '('
concurrent-iterator :on_value =>"companyA, companyB,
companyC" ,:to_field =>"company" do
^
SubProcessTest.rb:58: syntax error, unexpected ',', expecting kEND
concurrent-iterator :on_value =>"companyA, companyB,
companyC" ,:to_field =>"company" do
^
SubProcessTest.rb:58: syntax error, unexpected kDO, expecting kEND
SubProcessTest.rb:73: syntax error, unexpected kEND, expecting $end
What is wrong ? In the documentation the concurrent-iterator
expression is used in the same way (http://openwferu.rubyforge.org/
patterns.html#pat_13_multiple_instances_with_a_priori_design_time_knowledge ).
I have also some other problems with the iterator expression.
The version which is used in the example is OK, it works as expected.
But if i use a more dynamic version which is discussed in the
documentation
iterator :on_value => "${f:participant_list}", :to_variable => "p" do
participant "${p}"
end
nothing will happend (no iteration will take place) --> I think
somethink is wrong with the
:on_value => "${f:participant_list}" construct.
In my example if I use the dynamic dollor construct "${f:comp}" it
should work:
iterator :on_value => "${f:comp}", :to_variable =>"next_participant"
do
_if do
equals :field_value => "$
{next_participant}", :other_value => "bob"
# then
companyDefiner
# else
supplier :supplierName => "${next_participant}"
end
end
But no iteration will take place. What is wrong with that ?
Are somewhere some examples using complex dollor notations to access
a value in a complex workitem attribute ( a array of hash maps )
within the process definition ( usefull in "if", "case", ...
expressions ) ?
Best regards
Andreas
example:
--------------------------------------------
#!/usr/bin/env ruby
require 'rubygems'
require 'openwfe/def'
require 'openwfe/workitem'
require 'openwfe/engine/engine'
require 'openwfe/extras/participants/sqsparticipants'
require 'openwfe/extras/listeners/sqslisteners'
require 'openwfe/expressions/raw_prog'
require 'openwfe/tools/flowtracer'
#
# instantiating an engine
engine = OpenWFE::Engine.new
#
# adding some participants
engine.register_participant :companyDefiner do |workitem|
puts "put some companies to workitem..."
workitem.companyDefiner_companies =
"companyA,companyB,companyC,companyD, companyE"
workitem.companyDefiner_processInfos = [{"a"=>"1", "b"=>"2"},
{"a"=>"4", "b"=>"8"}, {"a"=>"3", "b"=>"9"},{"a"=>"9", "b"=>"15"},
{"a"=>"23", "b"=>"34"}]
workitem.attributes = {"field1" => ['4','3','5','9']}
end
engine.register_participant :supplier do |workitem|
puts "supplier got a workitem..."
puts workitem.lookup_attribute("params.supplierName")
puts workitem.lookup_attribute("field1.1")
end
class MainProcessDefinition0 < OpenWFE::ProcessDefinition
sequence do
companyDefiner
iterator :on_value => "x , y, z", :to_variable
=>"next_participant" do
_if do
equals :field_value => "$
{next_participant}", :other_value => "bob"
# then
companyDefiner
# else
supplier :supplierName => "${next_participant}"
end
end
concurrent-iterator :on_value =>"companyA, companyB,
companyC" ,:to_field =>"company" do
subprocess :ref => "supplierCommunication", :company => "$
{company}"
end
end
process_definition :name => "supplierCommunication" do
sequence do
supplier
end
end
set :field =>"comp", :value => "alice, bob, charly"
set :field =>"testfield", :value =>"testvalue"
end
li = OpenWFE::LaunchItem.new(MainProcessDefinition0)
#OpenWFE::trace_flow(MainProcessDefinition0)
li.initial_comment = "please give your impressions about http://ruby-lang.org"
fei = engine.launch(li)
engine.wait_for fei
Hi Andreas,
I will investigate these issues as soon as I'm in front of my workstation.
Thanks for the detailed report, best regards,
--
John Mettraux -///- http://jmettraux.openwfe.org
On 10/30/07, abau...@webware-experts.de <abau...@webware-experts.de> wrote:
>
> I was testing some expressions and found some problems.
> Below in the example is a concurrent-iterator expression.
>
> I get the following errors:
>
>
> ruby SubProcessTest.rb SubProcessTest.rb:58: syntax error, unexpected
> tSYMBEG, expecting kDO or '{' or '('
> concurrent-iterator :on_value =>"companyA, companyB,
> companyC" ,:to_field =>"company" do
> (...)
> What is wrong ? In the documentation the concurrent-iterator
> expression is used in the same way (http://openwferu.rubyforge.org/
> patterns.html#pat_13_multiple_instances_with_a_priori_design_time_knowledge ).
For Ruby "concurrent-iterator" means "concurrent minus iterator", you
have to use "concurrent_iterator". I'm fixing the documentation right
now.
Now investigating your next issues,
Hi,
I have tried to reproduce your issue in OpenWFEru trunk but without success :
http://openwferu.rubyforge.org/svn/trunk/openwfe-ruby/test/ft_15b_iterator.rb
This test just works fine for me. I added it anyway to the test suite.
I guess you're using OpenWFEru 0.9.15. Is there something in the logs
about your problem ?
This works for me :
---8<---
#!/usr/bin/env ruby
require 'rubygems'
require 'openwfe/def'
require 'openwfe/workitem'
require 'openwfe/engine/engine'
engine = OpenWFE::Engine.new
engine.register_participant ".*" do |workitem|
puts workitem.participant_name
end
class TestDef < OpenWFE::ProcessDefinition
sequence do
participant "${f:array.0.a}"
participant "${f:array.1.a}"
end
end
li = OpenWFE::LaunchItem.new TestDef
li.array = []
li.array << { "a" => "|A|", "b" => "|B|" }
li.array << { "a" => "_A_", "b" => "_B_" }
fei = engine.launch li
engine.wait_for fei
--->8---
I will enhance the documentation :
http://rubyforge.org/tracker/index.php?func=detail&aid=15195&group_id=2609&atid=10195
Best regards,
I found one reason of the problem.
Below :on_value => "${f:comp}" does'nt work as exspected because
I make a false assumption.
I thought that the field comp is part of the current workitem.
The participant "call" companyDefiner implicite 'consume' the field
comp.
If I comment the line with "companyDefiner" out then :on_value => "$
{f:comp}" is working properly
Is it normal that workitem fields are lost leaving a participant ?
What is the scope and the lifetime of workitem fields ?
Are there different scopes or lifetimes of workitem fields ?
This is potentially also related to my previous question:
Are somewhere some examples using complex dollor notations to access
a value in a complex workitem attribute ( a array of hash maps )
within the process definition ( usefull in "if", "case", ...
expressions ) ?
Best regards
Andreas
...
sequence do
companyDefiner
iterator :on_value => "${f:comp}", :to_variable
=>"next_participant" do
_if do
equals :field_value => "$
{next_participant}", :other_value => "bob"
# then
companyDefiner
# else
supplier :supplierName => "${next_participant}"
end
end
.....
On 30 Okt., 14:28, "John Mettraux" <jmettr...@openwfe.org> wrote:
> http://openwferu.rubyforge.org/svn/trunk/openwfe-ruby/test/ft_15b_ite...
No.
> What is the scope and the lifetime of workitem fields ?
Scope : the workitem. Lifetime : as long as not erased from the workitem.
> Are there different scopes or lifetimes of workitem fields ?
No. But when you use a concurrence, there is a workitem for each
branch of the concurrence.
There are rules about how workitems are merged back (into one) at the
end of a concurrence or a concurrent-iterator (please read
http://openwferu.rubyforge.org/rdoc/classes/OpenWFE/ConcurrenceExpression.html)
Maybe your issue is about defining a field in a concurrence branch...
But I've reread your code example and the field "comp" is set at the
end of the process definition, it's thus not visible.
Your "companyDefiner" participant seems not to touch your "comp" field at all.
Sorry not to be able to help you more. I tried to reply in the best
way possible with your given input.
> This is potentially also related to my previous question:
>
> Are somewhere some examples using complex dollor notations to access
> a value in a complex workitem attribute ( a array of hash maps )
> within the process definition ( usefull in "if", "case", ...
> expressions ) ?
I replied to that at :
http://groups.google.com/group/openwferu-users/msg/5f9037b8f7889e17
Best regards,
>>>Sorry not to be able to help you more. I tried to reply in the best
>>>way possible with your given input.
Your feedback and support helps me really !
Then problem with companyDefiner was the line:
workitem.attributes = {"field1" => ['4','3','5','9']}
It looks like that the other workitems are deleted.
For some other tests I tried to use the log expressing but in the
openwfe.log file a unknown expression 'log' exception is logged.
Is it necessary to make some additional imports or configurations ?
Best regards
On 30 Okt., 15:35, "John Mettraux" <jmettr...@openwfe.org> wrote:
> On 10/30/07, abaum...@webware-experts.de <abaum...@webware-experts.de> wrote:
>
>
>
> > I found one reason of the problem.
> > Below :on_value => "${f:comp}" does'nt work as exspected because
> > I make a false assumption.
> > I thought that the field comp is part of the current workitem.
> > The participant "call" companyDefiner implicite 'consume' the field
> > comp.
> > If I comment the line with "companyDefiner" out then :on_value => "$
> > {f:comp}" is working properly
> > Is it normal that workitem fields are lost leaving a participant ?
>
> No.
>
> > What is the scope and the lifetime of workitem fields ?
>
> Scope : the workitem. Lifetime : as long as not erased from the workitem.
>
> > Are there different scopes or lifetimes of workitem fields ?
>
> No. But when you use a concurrence, there is a workitem for each
> branch of the concurrence.
>
> There are rules about how workitems are merged back (into one) at the
> end of a concurrence or a concurrent-iterator (please readhttp://openwferu.rubyforge.org/rdoc/classes/OpenWFE/ConcurrenceExpres...)
Well done ! I should have spotted that by myself.
Indeed workitem.attributes = { ... } sets all the fields in one hit,
erasing the whole field set.
> For some other tests I tried to use the log expressing but in the
> openwfe.log file a unknown expression 'log' exception is logged.
> Is it necessary to make some additional imports or configurations ?
Sorry, it's a 0.9.16 feature, I updated the online documentation a bit
too fast...
Meanwhile, you can do :
engine.register_participant :log do |workitem|
engine.ldebug "LOG #{workitem.params.msg}"
end
in the process definition
sequence do
log :msg => "please log this"
end
Going to bed now, sorry, couldn't test this "log" participant, it
should work though...
Best regards, thanks for all the feedback,
I tried to use a more complex dollar notation but I got an exception.
The program and the exception is below.
What is wrong ?
I apply your example to my scenario and I thought that it should work,
but it does'nt.
Best regards,
Andreas
require 'rubygems'
require 'openwfe/def'
require 'openwfe/workitem'
require 'openwfe/engine/engine'
require 'openwfe/extras/participants/sqsparticipants'
require 'openwfe/extras/listeners/sqslisteners'
require 'openwfe/expressions/raw_prog'
require 'openwfe/tools/flowtracer'
engine = OpenWFE::Engine.new
engine.register_participant :log do |workitem|
#engine.ldebug "LOG #{workitem.params.msg}"
puts workitem.lookup_attribute("params.msg")
end
class TenderProcessDefinition < OpenWFE::ProcessDefinition
sequence do
_if do
equals :field_value => "${f:supplierList.
1.DunsNr}", :other_value => "ZUTE8555"
#then
log :msg => "matched"
#else
log :msg => "not matched"
end
end
set :field => "supplierList", :value =>
[{"name"=>"companyA","DunsNr" => "JGE4753"},
{"name"=>"companyB","DunsNr" => "ZUTE8555"},
{"name"=>"companyC","DunsNr" => "GTI6775"},
{"name"=>"companyD","DunsNr" => "XUE6755"}]
end
li = OpenWFE::LaunchItem.new(TenderProcessDefinition)
OpenWFE::trace_flow(TenderProcessDefinition)
li.initial_comment = "please give your impressions about http://ruby-lang.org"
fei = engine.launch(li)
engine.wait_for fei
-----------------------------------------------
exception:
I, [2007-10-30T22:44:28.015620 #1682] INFO -- : OpenWFE::Engine
'engine' - new() --- engine started --- 15380910
I, [2007-10-30T22:44:28.016978 #1682] INFO -- : OpenWFE::Engine
'engine' - new() --- engine started --- 15364530
I, [2007-10-30T22:44:28.019412 #1682] INFO -- : OpenWFE::Engine
'engine' - wait_for() 20071030-mipezaramu
W, [2007-10-30T22:44:28.030572 #1682] WARN -- :
OpenWFE::ExpressionPool 'expressionPool' - expressionPool
operation :do_apply on (fei 0.9.15 engine/engine field:__definition
TenderProcess 0 20071030-mipezaraji equals 0.0.0.0) failed with
exception : can't convert String into Integer
/Library/Ruby/Gems/1.8/gems/openwferu-0.9.15/lib/openwfe/utils.rb:
382:in `[]'
/Library/Ruby/Gems/1.8/gems/openwferu-0.9.15/lib/openwfe/utils.rb:
382:in `lookup_attribute'
/Library/Ruby/Gems/1.8/gems/openwferu-0.9.15/lib/openwfe/utils.rb:
388:in `lookup_attribute'
/Library/Ruby/Gems/1.8/gems/openwferu-0.9.15/lib/openwfe/workitem.rb:
174:in `lookup_attribute'
/Library/Ruby/Gems/1.8/gems/openwferu-0.9.15/lib/openwfe/util/
dollar.rb:141:in `[]'
/Library/Ruby/Gems/1.8/gems/openwferu-0.9.15/lib/openwfe/util/
dollar.rb:88:in `dsub'
/Library/Ruby/Gems/1.8/gems/openwferu-0.9.15/lib/openwfe/util/
dollar.rb:124:in `dosub'
/Library/Ruby/Gems/1.8/gems/openwferu-0.9.15/lib/openwfe/expressions/
flowexpression.rb:376:in `lookup_attribute'
/Library/Ruby/Gems/1.8/gems/openwferu-0.9.15/lib/openwfe/expressions/
flowexpression.rb:629:in `lookup_vf_attribute'
/Library/Ruby/Gems/1.8/gems/openwferu-0.9.15/lib/openwfe/expressions/
flowexpression.rb:600:in `lookup_value'
/Library/Ruby/Gems/1.8/gems/openwferu-0.9.15/lib/openwfe/expressions/
fe_equals.rb:87:in `lookup_values'
/Library/Ruby/Gems/1.8/gems/openwferu-0.9.15/lib/openwfe/expressions/
fe_equals.rb:69:in `reply'
/Library/Ruby/Gems/1.8/gems/openwferu-0.9.15/lib/openwfe/expressions/
fe_equals.rb:64:in `apply'
/Library/Ruby/Gems/1.8/gems/openwferu-0.9.15/lib/openwfe/expressions/
raw.rb:117:in `apply'
/Library/Ruby/Gems/1.8/gems/openwferu-0.9.15/lib/openwfe/expool/
expressionpool.rb:878:in `do_apply'
/Library/Ruby/Gems/1.8/gems/openwferu-0.9.15/lib/openwfe/expool/
expressionpool.rb:841:in `send'
/Library/Ruby/Gems/1.8/gems/openwferu-0.9.15/lib/openwfe/expool/
expressionpool.rb:841:in `do_process_workelement'
/Library/Ruby/Gems/1.8/gems/openwferu-0.9.15/lib/openwfe/util/
workqueue.rb:66:in `start_workqueue'
/Library/Ruby/Gems/1.8/gems/openwferu-0.9.15/lib/openwfe/util/
workqueue.rb:65:in `loop'
/Library/Ruby/Gems/1.8/gems/openwferu-0.9.15/lib/openwfe/util/
workqueue.rb:65:in `start_workqueue'
/Library/Ruby/Gems/1.8/gems/openwferu-0.9.15/lib/openwfe/utils.rb:
303:in `call'
/Library/Ruby/Gems/1.8/gems/openwferu-0.9.15/lib/openwfe/utils.rb:
303:in `call_in_thread'
/Library/Ruby/Gems/1.8/gems/openwferu-0.9.15/lib/openwfe/utils.rb:
291:in `initialize'
/Library/Ruby/Gems/1.8/gems/openwferu-0.9.15/lib/openwfe/utils.rb:
291:in `new'
/Library/Ruby/Gems/1.8/gems/openwferu-0.9.15/lib/openwfe/utils.rb:
291:in `call_in_thread'
/Library/Ruby/Gems/1.8/gems/openwferu-0.9.15/lib/openwfe/util/
workqueue.rb:64:in `start_workqueue'
/Library/Ruby/Gems/1.8/gems/openwferu-0.9.15/lib/openwfe/expool/
expressionpool.rb:120:in `initialize'
/Library/Ruby/Gems/1.8/gems/openwferu-0.9.15/lib/openwfe/contextual.rb:
78:in `new'
/Library/Ruby/Gems/1.8/gems/openwferu-0.9.15/lib/openwfe/contextual.rb:
78:in `init_service'
/Library/Ruby/Gems/1.8/gems/openwferu-0.9.15/lib/openwfe/engine/
engine.rb:652:in `build_expression_pool'
/Library/Ruby/Gems/1.8/gems/openwferu-0.9.15/lib/openwfe/engine/
engine.rb:114:in `initialize'
/Library/Ruby/Gems/1.8/gems/openwferu-0.9.15/lib/openwfe/tools/
flowtracer.rb:53:in `new'
/Library/Ruby/Gems/1.8/gems/openwferu-0.9.15/lib/openwfe/tools/
flowtracer.rb:53:in `trace_flow'
/Users/abaumann/Documents/KomodoProjects/SQSTestProject/
TenderProcess.rb:40
W, [2007-10-30T22:44:28.031278 #1682] WARN -- :
OpenWFE::ExpressionPool 'expressionPool' - expressionPool
operation :do_apply on (fei 0.9.15 engine/engine field:__definition
TenderProcess 0 20071030-mipezaramu equals 0.0.0.0) failed with
exception : can't convert String into Integer
/Library/Ruby/Gems/1.8/gems/openwferu-0.9.15/lib/openwfe/utils.rb:
382:in `[]'
/Library/Ruby/Gems/1.8/gems/openwferu-0.9.15/lib/openwfe/utils.rb:
382:in `lookup_attribute'
/Library/Ruby/Gems/1.8/gems/openwferu-0.9.15/lib/openwfe/utils.rb:
388:in `lookup_attribute'
/Library/Ruby/Gems/1.8/gems/openwferu-0.9.15/lib/openwfe/workitem.rb:
174:in `lookup_attribute'
/Library/Ruby/Gems/1.8/gems/openwferu-0.9.15/lib/openwfe/util/
dollar.rb:141:in `[]'
/Library/Ruby/Gems/1.8/gems/openwferu-0.9.15/lib/openwfe/util/
dollar.rb:88:in `dsub'
/Library/Ruby/Gems/1.8/gems/openwferu-0.9.15/lib/openwfe/util/
dollar.rb:124:in `dosub'
/Library/Ruby/Gems/1.8/gems/openwferu-0.9.15/lib/openwfe/expressions/
flowexpression.rb:376:in `lookup_attribute'
/Library/Ruby/Gems/1.8/gems/openwferu-0.9.15/lib/openwfe/expressions/
flowexpression.rb:629:in `lookup_vf_attribute'
/Library/Ruby/Gems/1.8/gems/openwferu-0.9.15/lib/openwfe/expressions/
flowexpression.rb:600:in `lookup_value'
/Library/Ruby/Gems/1.8/gems/openwferu-0.9.15/lib/openwfe/expressions/
fe_equals.rb:87:in `lookup_values'
/Library/Ruby/Gems/1.8/gems/openwferu-0.9.15/lib/openwfe/expressions/
fe_equals.rb:69:in `reply'
/Library/Ruby/Gems/1.8/gems/openwferu-0.9.15/lib/openwfe/expressions/
fe_equals.rb:64:in `apply'
/Library/Ruby/Gems/1.8/gems/openwferu-0.9.15/lib/openwfe/expressions/
raw.rb:117:in `apply'
/Library/Ruby/Gems/1.8/gems/openwferu-0.9.15/lib/openwfe/expool/
expressionpool.rb:878:in `do_apply'
/Library/Ruby/Gems/1.8/gems/openwferu-0.9.15/lib/openwfe/expool/
expressionpool.rb:841:in `send'
/Library/Ruby/Gems/1.8/gems/openwferu-0.9.15/lib/openwfe/expool/
expressionpool.rb:841:in `do_process_workelement'
/Library/Ruby/Gems/1.8/gems/openwferu-0.9.15/lib/openwfe/util/
workqueue.rb:66:in `start_workqueue'
/Library/Ruby/Gems/1.8/gems/openwferu-0.9.15/lib/openwfe/util/
workqueue.rb:65:in `loop'
/Library/Ruby/Gems/1.8/gems/openwferu-0.9.15/lib/openwfe/util/
workqueue.rb:65:in `start_workqueue'
/Library/Ruby/Gems/1.8/gems/openwferu-0.9.15/lib/openwfe/utils.rb:
303:in `call'
/Library/Ruby/Gems/1.8/gems/openwferu-0.9.15/lib/openwfe/utils.rb:
303:in `call_in_thread'
/Library/Ruby/Gems/1.8/gems/openwferu-0.9.15/lib/openwfe/utils.rb:
291:in `initialize'
/Library/Ruby/Gems/1.8/gems/openwferu-0.9.15/lib/openwfe/utils.rb:
291:in `new'
/Library/Ruby/Gems/1.8/gems/openwferu-0.9.15/lib/openwfe/utils.rb:
291:in `call_in_thread'
/Library/Ruby/Gems/1.8/gems/openwferu-0.9.15/lib/openwfe/util/
workqueue.rb:64:in `start_workqueue'
/Library/Ruby/Gems/1.8/gems/openwferu-0.9.15/lib/openwfe/expool/
expressionpool.rb:120:in `initialize'
/Library/Ruby/Gems/1.8/gems/openwferu-0.9.15/lib/openwfe/contextual.rb:
78:in `new'
/Library/Ruby/Gems/1.8/gems/openwferu-0.9.15/lib/openwfe/contextual.rb:
78:in `init_service'
/Library/Ruby/Gems/1.8/gems/openwferu-0.9.15/lib/openwfe/engine/
engine.rb:652:in `build_expression_pool'
/Library/Ruby/Gems/1.8/gems/openwferu-0.9.15/lib/openwfe/engine/
engine.rb:114:in `initialize'
/Users/abaumann/Documents/KomodoProjects/SQSTestProject/
TenderProcess.rb:13:in `new'
/Users/abaumann/Documents/KomodoProjects/SQSTestProject/
TenderProcess.rb:13
Hi Andreas,
you've spotted two things.
1). the process fails silently, that's bad, you had to use trace_flow
to detect the root error. I have to to fix that.
2). the root issue, the array is set in the process definition, using
Ruby, IIRC, the array is turned into a String, I have to check why
it's like that for now. It guess it would follow the "principle of
least surprise" if it simply worked the way you coded it.
I have to investigate those two issues.
For now, I recommend that you set such array/hash values inside of
participants or when preparing the launch items, not in the process
definition.
Thanks and best regards,
I was wrong, it did not fail silently, I could fetch the stack trace with
puts engine.get_error_journal.get_error_log(fei)[0].stacktrace
> 2). the root issue, the array is set in the process definition, using
> Ruby, IIRC, the array is turned into a String, I have to check why
> it's like that for now. It guess it would follow the "principle of
> least surprise" if it simply worked the way you coded it.
That still holds, these complex lookups should never fail. If they
don't apply, a nil/blank value should be returned.
I fixed that at revision 1212, the tests are at
http://openwferu.rubyforge.org/svn/trunk/openwfe-ruby/test/lookup_att_test.rb
I'll work on this "Ruby array within the process definition" issue a bit later.
Danke sehr,
On 10/31/07, John Mettraux <jmet...@openwfe.org> wrote:
>
> I'll work on this "Ruby array within the process definition" issue a bit later.
It's in, at revision 1214.
This is now possible :
---8<---
process_definition :name => "test", :revision => "0.1" do
sequence do
set :field => "f0", :value => [ "this", "is", "my", :ruby,
"array" ] # <======= here
participant "Toto"
end
end
--->8---
Before revision 1214, the array was turned into a String.
Best regards,
Thank you for your quick response and the fix.
After checking out revision 1214 I tried to create the gems in the way
describe it in the documentation.
At command line:
rake gem
The problems is I got an error due to the line 16 in the Rakefile:
include Rote
error:
no such file to load --rote
Excuse me I'm not so familiar with rake.
Do you have a hint what the problem is ?
Best regards,
Andreas
On 1 Nov., 13:11, "John Mettraux" <jmettr...@openwfe.org> wrote:
> Hi,
>
Hi Andrea,
simply doing
sudo gem install rote
should get you started.
Thank you
Best regards
Andreas
On 2 Nov., 09:47, "John Mettraux" <jmettr...@openwfe.org> wrote:
I'm working with revision 1214.
Your fix works but a got another supprising result.
The line:
participant :ref => "logger", :msg =>"${f:supplierList.1.DunsNr}"
write to the output: ZUTE8555
because of this I would expect that the "then" part of the "_if"
statement should be executed but this is not the case.
What is wrong here ?
_if do
equals :field_value => "${f:supplierList.
1.DunsNr}", :other_value => "ZUTE8555"
#then
participant :ref => "logger", :msg => "matched"
#else
participant :ref => "logger", :msg => "not matched"
end
My small example test program :
require 'rubygems'
require 'openwfe/def'
require 'openwfe/workitem'
require 'openwfe/engine/engine'
require 'openwfe/extras/participants/sqsparticipants'
require 'openwfe/extras/listeners/sqslisteners'
require 'openwfe/expressions/raw_prog'
require 'openwfe/tools/flowtracer'
engine = OpenWFE::Engine.new
engine.register_participant :logger do |workitem|
#engine.ldebug "LOG #{workitem.params.msg}"
puts workitem.lookup_attribute("params.msg")
end
class TenderProcessDefinition < OpenWFE::ProcessDefinition
sequence do
participant :ref => "logger", :msg =>"This is a test"
participant :ref => "logger", :msg =>"${f:supplierList.
1.DunsNr}"
_if do
equals :field_value => "${f:supplierList.
1.DunsNr}", :other_value => "ZUTE8555"
#then
participant :ref => "logger", :msg => "matched"
#else
participant :ref => "logger", :msg => "not matched"
end
end
set :field => "supplierList", :value =>
[{"name"=>"companyA","DunsNr" => "JGE4753"},
{"name"=>"companyB","DunsNr" => "ZUTE8555"},
{"name"=>"companyC","DunsNr" => "GTI6775"},
{"name"=>"companyD","DunsNr" => "XUE6755"}]
end
li = OpenWFE::LaunchItem.new(TenderProcessDefinition)
#OpenWFE::trace_flow(TenderProcessDefinition)
li.initial_comment = "please give your impressions about http://ruby-lang.org"
fei = engine.launch(li)
engine.wait_for fei
Best regards
Andreas
On 1 Nov., 13:11, "John Mettraux" <jmettr...@openwfe.org> wrote:
> Hi,
Hi Andreas,
you should write :
equals :value => "${f:supplierList.1.DunsNr}, :other_value => "ZUTE8555"
what you have written is equivalent to
equals :field-value => "ZUTE8555", :other-value => "ZUTE8555"
which can be read as "is the value contained in the field named
'ZUTE8555' equal to 'ZUTE8555' ?"