SharePoint Diva

April 28, 2009

Form Numbering for Multiple Locations with ShareVis and SharePoint

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.

April 20, 2009

March 10, 2009

Using SQL inside Workflow

Filed under: SQL, SharePoint — sharepointdiva @ 10:38 pm
Tags: , , , , , ,

Thanks to iLove SharePoint for creating the “Execute SQL” action.

With it I was able to create a workflow against the add/change event in my document library to create a link to my equipment page based on if there is any information to link to.

I first store my select statement in a variable so I can log it to the history file (this was helpful with debugging the workflow.)

SELECT COUNT(DWG_NAME_) FROM AccessDatabase…[AccessTable] where DWG_NAME_ = ‘[%DocumentLibrary:FileName%].DWG’

Then using the Execute SQL action, I can query the Access Database to see if there is anything I want to link to and store the results in a variable. I can then also show how many items there are in the hyperlink text. (The connection string I used was: Data Source= OFFICESERVER;Initial Catalog=WSS_Content;Integrated Security=SSPI. This particular server uses Studio Express on the same server as SharePoint.)

So if there is something to link to, I create the URL text: Store Helpful text-[%Variable: SQLResult%] in Variable: URLText.

Then I build the URL string:

And store it in the hyperlink column of my document library. The user will know that only the drawings with links have something in the Access Database to look at:

Using Data from Access in SharePoint via SQL

This is a reoccurring issue I have; I don’t know C# beyond one program I wrote 3 years ago when my career path took me away from development and toward other areas. But now, working with SharePoint, this has become a handicap – I want to accomplish a task that is more complicated than straight SharePoint Designer can handle. Unfortunately I don’t have time to defer the task while I learn the C# that would solve this task in a more efficient manner. OK, so it is imperative that I get around to learning C#. Until then what can I do? I do know SQL. This leads me to my current workaround.

Task: Create a site for an engineering project that will store drawings, pieces of equipment (known by their tags), and all specs and requisitions related to those tags. The drawings are created with a program called CADworks. CADworks stores information about the drawings (such as the tag numbers) in an Access database. Pull in the information from the Access database into a SharePoint Equipment list that can be used to tie together drawings (stored as PDF’s in a SharePoint library), Specs (information can be in lists or libraries), Requisitions (lists), and Purchase Orders (library.)

I hoped first to use a ShareVis workflow to take the drawing number as it’s uploaded into the library and pull the data from the Access database and manipulate the list then. However, that functionality does not currently exist with ShareVis – the plug-ins that looked like they might be able to do what I wanted are for forms only. (They did however pass on that request to their development department. I have hope that it will be possible in the future.)

Issue: Can’t insert into SharePoint List via SQL Insert. So can I pull data from Access AND SharePoint Libraries to create a cross-linking data view?

  1. Create a linked server to access an Access database. See Configuring a Linked Microsoft Access Server on SQL 2005 Server . Since the CADworks database is stored on the shared drive, I’ll need to create a batch file to copy it to the SQL server nightly.
  2. Create store procedure to query access database:

    set ANSI_NULLS ON

    set QUOTED_IDENTIFIER ON

    GO

    – =============================================

    – Author:        SharePoint Diva

    – Create date: 3/10/2009

    – Description:    Pull data from Linked Access Database

    – to display in a data view on SharePoint

    – =============================================

    ALTER PROCEDURE [dbo].[csp_GetComponentsMechanical]

        – Search by PID if provided, otherwise use wild card

        @pid varchar(40) = ‘%’

    AS

    BEGIN

        – SET NOCOUNT ON added to prevent extra result sets from

        – interfering with SELECT statements.

        SET NOCOUNT ON;

     

        – Inside declare for debugging

        – DECLARE @pid varchar(40)

        – SET @pid = ‘%’

     

    – Insert statements for procedure here

        SELECT DISTINCT REPLACE(DWG_NAME_,’.DWG’,”) AS [P&ID], REPLACE(TAG_,’-',”) AS [Equip. Tag]

        FROM AccessDatabase…[AccessTable]

        WHERE DWG_NAME_ like @pid

    END

     

  3. Create Database Connection in SharePoint Designer:


     


     

  4. Create a data view in SharePoint Designer:

     

  5. Modify the DataForm field to create a hyperlink to the drawings library based on the value of the field:

    Address example: http://DevActiveProject/DrawingsDesign/Forms/AllItems.aspx?&FilterField1=P%5Fx0026%5FID&FilterValue1={@P_x0026_ID}

     

    So now I have an equipment page containing data from Access that links to my document library, and because of the query string parameter, I can create a link in my document library that will redirect to a filtered view of my equipment page.

     

     

    I’ll cover in a following post the workflow I created for my library to create the hyperlink back to this list.

 

 

February 11, 2009

From SharePoint List thru Excel to Web Part

How do you take information from your SharePoint list and display it in a pivot table on a SharePoint page? This can be achieved by using Excel’s Data Connections and Excel Services. This article will walk through the steps of going from a SharePoint list to an Excel Pivot Table and then to displaying the pivot table on a SharePoint page.

 

Export the list to a pivot table

 

Change the view of the list to “Edit in Datasheet”.
  

On the right side of the list is a subtle arrow. This is the hidden task pane. Click the arrow to open the task pane.

 

Select “Create Excel Pivot Table Report”

  

Choose the fields to put on the pivot table.

 

For more information on creating Pivot Tables with Excel 2007 see the Excel 2007 Courses site.

  
Change the name of your Pivot Table to something meaningful. This is how you’ll identify the table to the web part.
Publish to Excel Services

 

When you’re ready to publish your table, select the windows button > Publish > Excel Services.
  

Select the SharePoint document library you’d like to publish to.

 

If you need to add a network place, use the “new folder” button to launch the wizard.

  
Open “Excel Services Options…”
  
Select “Items in the Workbook” from the Show selection dropdown.
  

Select the pivot table created and click “OK”.

 

After naming the file, click “Save”. This will publish the workbook to SharePoint and Excel Services.

  
Excel Services will open with a preview of the report created.

 

Close the tab when you’ve finished reviewing the output.

 

 

Create the Web Part Page

 

Back on the SharePoint site, create a new page.
  

Enter in a Title, the URL Name (without spaces, using CamelCase), and “Blank Web Part Page” for the layout.

 

Create.

  
Add a web part
  
Add an Excel Web Access web part.
  

In the web part, you’ll see “Click here to open the tool pane.”

 

Inside the tool pane, the ellipsis next to the Workbook will open a browse menu to libraries/lists in the site. Locate the document library the workbook was published to.

 

You may need to use the paging option at the top to retrieve the next set of options.

  

Select the workbook that was published earlier.

 

Alternatively, if you have the URL, you can just enter that into the Workbook field.

  

In the Named Item, enter the name of the pivot table (exactly as it was named earlier in the workbook.)

 

Click “Apply”.

 

Click “Save and Stop Editing” to view the page normally.

  

The page will be saved into the “Pages” document library, a library that is common to all SharePoint sites.

 

Copy the URL to add to a link list.

  
This link can then be added to another page more accessible to others.
Refreshing the list

 

When the originating SharePoint list has changed, for example new items have been added to the list, the excel pivot table will need to be opened and refreshed. (Instructions on having the data refresh automatically will be added in another post.)

 

Open the document library housing the spreadsheet, and “Edit in Microsoft Office Excel.”
  
On the “Data” tab, select “Connection” and “Refresh”, then “Close”.

 

You should see the new totals reflected on the pivot table in the workbook.

 

Click “Save”. Since the workbook was opened from SharePoint it will save back to SharePoint. You do not need to republish it.

 

Close the workbook and refresh the page with the web part to view new data.

August 27, 2008

Copy List Items between Sites

Filed under: SharePoint — sharepointdiva @ 6:50 pm
Tags: , ,

Steps will need to be run by SharePoint Administrator:

  1. Download Useful Sharepoint Designer Custom Workflow Activities
  2. Extract all files in the archive to a singe location.
  3. Run setup.exe
  4. Go to Central Administration -> Application Management -> Manage Web Application Features and activate the feature for desired web applications (usually it’s Sharepoint – 80 or Sharepoint – 443).

To create workflow:

Open up Sharepoint Designer, connect to your site and create a new workflow: 


Action: Copy List Item Extended 


Choose List Item “Current Item”


To list at this URL


Leave option to “Overwrite existing items”


Use variable (rename it to be clearer) to store ID.


I don’t know where that can be used yet since there isn’t an Update List Item Extended. Maybe that’s for a future enhancement or for those that can extend the project code.

Click Finish.

Open Calendar Item and select Workflows:


Start the workflow:



Go back into the workflows on the calendar entry to see the workflow history:


Once you’ve verified that the workflow works manually, you can change it to run automatically on item add or change.

June 6, 2008

GroupBoard Workspace: Bad

I’ve encountered two problems since installing the Microsoft GroupBoard Workspace. One was causing the week-view of the calendar to give an error. The second was anytime I tried to add a content database, I’d get the error:

The specified SPContentDatabase Name=SharePoint_Content Parent=SPDatabaseServiceInstance has been upgraded to a newer version of SharePoint. Please upgrade this SharePoint application server before attempting to access this object.

There was nothing in SharePoint to upgrade, we’ve already installed the most up-to-date service packs. I found that the problem was the GroupBoard Workspace. Once I un-installed it, as suggested by GPK2005 on the Microsoft TechNet forum, I was able to add my content database without issues.

Thank you GPK2005.

June 3, 2008

Attaching this database requires upgrade…

I’m trying to add a content database to an existing Web Application.  I go into Central Administration > Application Management > Content Databases and Add a content database.  I then get the error: 

Attaching this database requires upgrade, which could time out the browser session.  You must use the STSADM command ‘addcontentdb’ to attach this database.   

The content database gets created in the separate SQL Server (2005).  Running the STSADM command gives the following error in the error log: 

The specified SPContentDatabase Name=blah_Content Parent=SPDatabaseServiceInstance has been upgraded to a newer version of SharePoint. Please upgrade this SharePoint application server before attempting to access this object. 

Nothing requires an upgrade, by following the steps in this article, I was able to create the content database and attach it to the web application. 

Reproduced Content from Article (just in case link disappears): 

Step a: Use SQL Query Analyzer to create the database

Use SQL Query Analyzer to create a new content database for use with the virtual server in Windows SharePoint Services. You cannot use the Create Database Wizard in the SQL Server Enterprise Manager tool to create the new database. Instead, run the following two queries in SQL Query Analyzer. When you use the following queries, make sure that you do the following:

·         Replace each instance of WSS_Content in the queries with the name that you want to use for the database.

·         Replace each instance of AdminVsAppPoolIdentity in the query with the account that is the SharePoint Central Administration virtual server application pool identity. This account is also the database owner (dbo) of the database.

·         Replace each instance of ContentVsAppPoolIdentity in the query with the account that is the content virtual server application pool identity.

·         Replace each instance of Domain in the query with the domain name.

Use the following query to create the database: 

– Windows SharePoint Services Content Database Creation Script
– TODO: Change the database name from WSS_Content to the name of the database that you want to use
CREATE DATABASE [WSS_Content] COLLATE Latin1_General_CI_AS_KS_WS
exec sp_dboption [WSS_Content], autoclose, false
GO

 

Use the following query to configure permissions for the database that you created: 

– Windows SharePoint Services Content Database Creation Script
use WSS_Content
– TODO: Change AdminVsAppPoolIdentity to the SharePoint Central Administration virtual server application pool account and change ContentVsAppPoolIdentity to the content virtual server application pool account.

DECLARE @AdminVsAppPoolIdentity nvarchar(128 )
DECLARE @ContentVsAppPoolIdentity nvarchar(128 )
SET @AdminVsAppPoolIdentity = N’Domain\AdminVsAppPoolIdentity’
SET @ContentVsAppPoolIdentity = N’Domain\ContentVsAppPoolIdentity’

EXEC sp_grantlogin @ContentVsAppPoolIdentity;
EXEC sp_grantlogin @AdminVsAppPoolIdentity;

– The following line will fail with error 15007 if @AdminVsAppPoolIdentity is the Network Service account.  This is expected.
EXEC sp_changedbowner @AdminVsAppPoolIdentity;

– The following line will fail with error 15063 if the account is not the Network Service account.  This is expected.
IF NOT EXISTS (SELECT * FROM sysusers WHERE name=@ContentVsAppPoolIdentity) EXEC sp_grantdbaccess @ContentVsAppPoolIdentity;

– The following line will fail with error 15410 if the account is not the Network Service account.  This is expected.
EXEC sp_addrolemember ‘db_owner’, @ContentVsAppPoolIdentity;

Step b: Add the content database to the virtual server

Use Windows SharePoint Services Central Administration to add the content database to the virtual server. To do this, follow these steps.

  1. Click Start, point to All Programs, point to Administrative Tools, and then click SharePoint 3.0 Central Administration.
  2. Click Application Management, and then click Content databases under SharePoint Web Application Management.
  3. On the Manage Content Databases page, click Add a content database.
  4. In the Web Application area, click the name of the Web application to which you want to add the content database.
  5. In the Database Name and Authentication area, specify the name of the database, the name of the database server, and the authentication method.
  6. In the Database Capacity Settings area, type the number that you want in the Number of sites before a warning event is generated box and in the Maximum number of sites that can be created in this database box, and then click OK.

Note If you configured permissions for the database with the NT Authority\Network Service account, you have to add the Network Service account to the System Administrators role in SQL Server before you can follow this step. You cannot make the Network Service account the database owner (dbo) of the database. You have to add the Network Service account to the System Administrators role before you can add the database to the virtual server. After you add the database to the virtual server, remove the Network Service account from the System Administrators role in SQL Server.

 

 

 

 

 

 

May 29, 2008

Office SharePoint Server Search Service stuck

Filed under: MOSS 2007, SharePoint, Trackback — sharepointdiva @ 11:03 pm
Tags: , , ,

How did I get here? Sometime this morning I was trying to fix an issue with the people search feature not working. While trying to correct that, I got stuck in the limbo of Office SharePoint Server Search remaining in the status of “Stopping” without ever getting to the status of “Stopped”. Apparently this is a common issue, but the recommended fix for it, running “stsadm -o osearch -action stop”, isn’t working for me. 


Changed the “Log On As” to Local System, disabled the service and rebooted. Once back up, re-enabled the service, started it, stopped it. Still showed as Stopping in the Central Administration. Re-ran the command “stsadm -o osearch -action stop”. YAY!


Tried to start: An unhandled exception occurred in the user interface.Exception Information: OSearch (DOMAIN\ShareAdmin)

Change the “Log On As” back to the (DOMAIN\ShareAdmin) and start the service from Central Administration > Operations > Services on Server. Everything was back up. 

Below is a link to one of the options I tried. While it didn’t fixe this particular issue, I’m sure this will come in handy in the future.  

SharePoint Services Timer Service File System Cache

Resetting the file system cache have resolved many issues I had in my SharePoint farm. Microsoft tech support gave me this resolution to fix some issues I had with Usage Analysis. I perform this operation first if I get stuck with any issues related to timer jobs. Good times!

May 27, 2008

Site Directory is Petarded

Filed under: MOSS 2007, SharePoint — sharepointdiva @ 4:36 pm
Tags: , , , ,

I’m using trying to use the Site Directory Template. Out of the box, it creates “categories” for Division and Region. Of course I want to use my own categories and I remove those for my own. Being of a database driven mentality, I of course make my columns lookup columns to be driven from list values that I’ll be using over and over throughout my site; Department and Location. So why can’t I get these new columns to show up in the “Categories” tab?

Because only “choice” columns are made into Categories. And those choices are “hard coded” inside the column definition.

Grrrrr.

Next Page »

Blog at WordPress.com.