Hello ruote list,

let me try an experiment.

I've noticed that some questions are fired on IRC (freenode #ruote)
and they get answered (Thanks Torsten, Kenneth et al), but sometimes I
wish I were there to answer, and more importantly, the question /
answer should be more easily reachable / searchable / debatable.

So let me start this "in reply to #ruote" kind of email.

</explanation>

> 2010-02-03 13:51:48 utc anb_: what I miss in it is the ability to search 
> through running processes by variables
> 2010-02-03 13:52:06 utc anb_: for example, to find every processes that has a 
> variable customerId with value 99938

Hello Anthoine,

You could do

---8<---
  processes = engine.processes.select do |ps|
    ps.variables['customerId'] == 99938
      # only variables at the top of the process "/customerId"
    #ps.all_variables['customerId'] == 99938
      # all variables at any scope level
  end
--->8---

  http://github.com/jmettraux/ruote/blob/ruote2.1/lib/ruote/engine.rb#L132-164
  
http://github.com/jmettraux/ruote/blob/ruote2.1/lib/ruote/engine/process_status.rb

Usually though, you're more interested in workitems.

If you use the StorageParticipant :

---8<---
  participant = Ruote::StorageParticipant.new(engine)
    # getting a grip on the "storage participant"

  workitems = participant.by_field('customerId', 99938)

  workitems = participant.by_field('customerId')
    # all the workitems that have a customerId field
--->8---

  
http://github.com/jmettraux/ruote/blob/ruote2.1/test/functional/ft_20_storage_participant.rb#L131-147


Best regards,

-- 
John Mettraux   -   http://jmettraux.wordpress.com

-- 
you received this message because you are subscribed to the "ruote users" group.
to post : send email to [email protected]
to unsubscribe : send email to [email protected]
more options : http://groups.google.com/group/openwferu-users?hl=en

Reply via email to