Form Numbering for Multiple Locations with ShareVis and SharePoint
April 28, 2009 4 Comments
I’m currently developing a Management of Change form using ShareVis. This is a large process, launching sub-forms and approval routings and links to drawings, so it’s also a great learning experience. As I tackle how best to proceed with all the requirements I’m going to share what I’ve done. I hope for two things; first, to give others the opportunity to see real examples of the working with ShareVis. Second, to get more eyes on what I’m doing for feedback. I don’t work with a team of developers so I’m alone when it comes to brainstorming and development. If you see something I’ve done and know of a better way, please let me know.
My first requirement with my management of change was how to handle form numbering. ShareVis comes with a name template that will automatically generate a unique name for the form. However, I needed to be able to sequence within the location – i.e. A change in San Diego and a change in Los Angeles will need to have two forms created, but the form will need to be named to include the location and the change number for that location not a count of all changes.
First I create a list to track the number count for each location.
This includes a calculated column to display the number in a way I want (with leading zeros), the code for the location, the partnering company (this will affect routing later on), and the plant manager. For this example we’re really only interested in the Location, NumberCount and Counter.
Next is the form:
I want to stop here and point out myFields in the Data source. If you rename “myFields” to something else, the ShareVis.Query will not work. I’ve reported this to ShareVis and they’ve been really good about fixing “features” I find, so it might not be long before this is handled as well. In the meantime, save yourself some frustration and don’t rename myFields and don’t group fields when you don’t need to. Field grouping was another gotcha I ran into.
Here is the detail of my ShareVis.Query:
Query: list=MOCFormInfo;filter=[Location]==@[//my:locationName];select=[NumberCount],[Location],[Code],[Company],[Counter]
Set Fields: locationNumberCount=NumberCount,locationCode=Code,locationCompany=Company,locationTitleCounter=Counter
Here is the detail of the ShareVis.FormName properties:
Template Name & Fields: TOMOC,//my:locationCode,//my:svHyphen,//my:stringCounter
stringCounter is used to strip out the leading characters from the calculated column. ShareVis already has the fix for this – but I haven’t applied it yet. Plus I thought it might be helpful to someone else to see how I handled this.
Calculate the next number for this location and promote this property so the workflow can process it.
TOMOC is the name template:
You’ll need to create the real Name Template and just ignore the one created when the form is published.
The last thing is handling the update of the NumberCount within the form process. I’m enjoying the simplicity of this flow while I can; it’s going to quickly get really messy.
Plugin “Set SharePoint Column”:
ValuePairs:
So this is how I’m handling the numbering within the location for multiple locations. My real form has to deal with 10 locations. Please give me your feedback. And if you’re using ShareVis, please join our Google Discussion Group.