Closed (fixed)
Project:
Workflow
Version:
6.x-1.5
Component:
Miscellaneous
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
16 Nov 2011 at 22:06 UTC
Updated:
5 Jan 2012 at 20:33 UTC
hi
I trying to do something that i think is trivial but i can´t. I want to show in a view a list of nodes acoording its "current state" , so i use it as argument.
The question is that i need to pass the current state title, and it seems that the argument only accepts the current state ID.
It´s in that way or i am forgeting something?
Comments
Comment #1
Bastlynn commentedIf you're trying to show a list of nodes, and display and filter the results by the current state... passing an argument isn't the way to go about it.
You want to display the current_state as a field. And filter the node display by current_state set to the state you want, or perhaps even exposed so you can readily pick between the ones you want.
Take a closer look at how workflow/pending view is set up - it makes a great modle for doing what you're trying to do.
Let me know how that works out for you.
Comment #2
qproHi , thanks for your quick response but i think that filters are not suitable for this case, i will try to explain the concept with an equivalent example:
I have 2 content types "garages" and "cars" and cars can move from one garaje to other and i need to tracking these movements.
So for tracking this i use workflow module where each state is a garage , in that way , when a car change its state from "garage A" to "garage B" it is tracked by workflow
The problem is that I create a Panel for showing the information of each garage including the list of cars inside (the aforesaid view),so the argument to show the cars in "garage B" is current state "garage B" which i am trying to get from Panel title but argument seems to accept the current state ID only.
Tricky situation,not?
Comment #3
Bastlynn commentedI really think you're over complicating this. It sounds like you have the workflow end of things taken care of, it's just getting the view to show that's causing trouble.
What is the URL structure you're aiming for here? Are your garage A and garage B views showing at different URLs such as: www.yoursite.com/garage/A and www.yoursite.com/garage/B ?
If so, then a filter will cover that situation perfectly. Make two page displays with the menu for one set to the first URL, and the menu for the second set to the other - and set the filter to the correct setting for the pages. You could do the same thing with blocks instead of page displays if you want to pull the information into panels at other pages.
The only reason to use an argument here is if you expect the argument value to be a dynamic thing - to change often and without human intervention (such as taxonomy tags). But your argument is a state, it *shouldn't* change once you have the workflow set up, so you can set up a filter specifically for it.
Comment #4
qproSorry I didn't give you all the data, there is near 250 garages and the final users can create garages, so there is too much garages to make page displays and users are not prepared for configuring filters in views.
I am thinking about creating a rule like "when the panel page garage X is going to be viewed set the sid x variable in arguments" or something la that, i am novice in Rules.
Its interesting to comment that which so many states, workflow transitions edit page is not able to load, so i had to configure directly in corrresponding db tables. Maybe , It could be good a light transitions page to let use workflow in this way.
Comment #5
Bastlynn commentedUm - in your case, workflow may not be the best case. Personally, I would have used taxonomies, especially if you're expecting users to start adding states as they go. Workflow is really designed for hard-set business logic, such as the flow of an article through editorial, layout, and final publication. That kind of flow doesn't change unless the company gets a new department, or the editorial staff splits.
Let me ask another questions to get a feel for what you're dealing with.
Are you limited for what garage you can go to from particular garages? Or does it not matter where the car started to where it ended, so long as you have it on record that it was moved, when, where from, where to, and by who?
Comment #6
qproHello Bastlynn
Sorry for delaying but i was envolved in other drupal site and trying to solve this issue too.
To "get a feel what i'm dealing with" let me tell you the real case , because garages case was only an simplified example for quickly explanation, and you seems really interested.
This drupal site is for a regional weather stations invetory management, so garages are wheather stations which are located throughout the country, and cars are the measuring equipment like rain gauge , ozone meter , etc.., so... when a measuring equipment is damaged is moved to the workshop (another garage) meanwhile other measuring equipment goes to this weather station from the stock (another garage). Normally , when the equiment is fixed it will be set in a diferent station or it will go to the stock.
To reduce the number of posibles transitions, I introduced the idea that every equipment have to pass through a intermediate state even if the movement it's from Station A directly to Station B:
· Station A -> Stock -> Station B
· Station A -> Workshop -> Station B
. Station A -> In transit -> Station B
In this way I skip a lot of transitions as A->B , A->C , C->A , ...
Crazy, no? There is a little more.
As I told you before , to show the equipments placed in the corresponding station, i put a equipments view in the station's Panel.
This view should take the title of the corresponding station's panel as the "Current state" argument, but the problem was that this argument only understands the ID state , not the title.
The poor solution for me was create a new hidden field "Location" in equipment content type and rewrite it with the workflow name state each time the state is changed. For this I used rules module :
- ON event Workflow state has changed, if content type is equipment, do modify node fields writting [workflow-current-state-name] in Location field.
and then in the station panel, in the content tab of the variant:
- Argument Content: Location (field_location_equip) using context Node: ID converted into Node title.
For the moment it works.
I always try to solve this drupal issues without programming for two reasons:
- I dont know programming. Recently i decided is better to learn python than php for my general software development purpouses.
- Using the "powermodules" (for me: views, panels, rules and token) , you get more flexibility and compatibility for likely future changes and you prevent from code maintenance.
I hope this long story about my experience could give someone a clue about drupal site building techniques, and show you another point of view about other posibles workflow usages.
Thanks and regards
Comment #7
Bastlynn commentedOk, I see what you're working with here. I'm glad you got it working - but I think the trouble you were seeing is because Workflow *is* really not the best approach for this problem. I have an alternate version of addressing this problem that you may want to consider next time you run across this issue:
a) Create a content type representing your inventory, with whatever you need to track it.
b) Create a content type 'Inventory record', that includes a node reference to an inventory item, a reference to a user, a date, etc. Whatever you need to gather for your record keeping.
c) Create a taxonomy of stations, which allows people to readily add new stations when you need to. Associate this taxonomy with items and inventory records and set it to allow only one term to be selected.
d) Create a rule, when a *item* node is saved, check the taxonomy for changes. If the item taxonomy has changed (indicating it's moved to another station), create a new inventory record with all the information you need from the updated item and the context of the change.
At that point you can use views to dig into an item list filtered by term id to find out what's where, and make a view of records to have a history for a station or for an item. Whatever you need to get at.
I'm glad you got it working though, best of luck!
Comment #7.0
Bastlynn commentedBetter english