29 October 2009

Implement Custom Auto Number Functionality in SharePoint

Note: I found this in a google search.

• Created a new list that holds autonumber information, named it "Unique Numbers".
• Add one integer field, "LastNumber" and one calculated field "NextNumber" to this list. NextNumber formula is "[LastNumber]+1"
• Add item(s) in this list for any autonumber columns I wish to have. For example, for my "Customers" list I want to have an auto-incrementing CustomerNo column. I want to start numbering my first customer as 1000. So I add an item to this list:

Title = CUSTOMERNO

LastNumber = 999

Then, you need to create a workflow in Sharepoint Designer that will trigger on "New item created" (or in your case, I guess it would be on item changed). This workflow should then perform a lookup against "Unique Number", find the item where Title=CUSTOMERNO, get the "NextNumber" value into a variable, store this value into the CustomerNo column, and then update "Unique Numbers" setting LastNumber = your NextNumber variable.
How to Create a WorkFlow
I will assume you have the "Unique Numbers" list setup as described in my post above. Continuing on my "CustomerNo" example, here's what you need to do in Sharepoint Designer (SPD).

1. Open your web site in SPD.
2. Create a new workflow. In the File menu, select New->Workflow...
3. In the dialog that appears, give the workflow a name, e.g. "Assign Customer Number". In the drop-down list below, choose to connect the workflow to the list you want to assign autonumbers to (In this case, this would be a list called Customers). Then check the middle option of the three check boxes below, "Start this workflow automatically when a new item is created".
4. On the same dialog, there is a button at the bottom called "Variables...". Click it. Choose "Add", name it "mNumber" and make it of type "Number". Click OK, and OK again. Now, click "Next" in the dialog.
5. You can leave the step name as is ("Step 1"). Leave the "Condition" empty, and click the "Actions" button. In the menu that appears, select "Set workflow variable". This will add an action to the list to the right of the Actions button. Now you need to set up this action. Click the link "Workflow variable", this will open a small dropdown list. Select "Variable: mNumber". Then click the next link, "value". This will display a textbox and a small button in place of the link. Click the button “fx” ("Show databindings"). This will bring up a new dialog, where you will select the value to assign to the "mNumber" variable. In the "Data Source" drop down, select "Unique Numbers". In the drop down just below ("Field:") select "NextNumber". Now, the dialog will be expanded with a "Find list object" section. In the drop down "Field:", select "Unique Numbers:Title", and in the value box below, type CUSTOMERNO. Click OK. SPD will now give a warning that the look up might return more than one value, just select "Yes" to continue here.
6. Now you add one more action. Click the "Actions" button and select "Set field in current object Item". Click the "field" link in the new action, and in the list that appears, select the field in your list that is the target of the autonumber (e.g. "CustomerNo"). Then click the "value" link, and once again click the little button that appears ("Show databindings"). This time, in the "Data Source" drop down, select "Workflow data", and then in the next drop down, select the variable "mNumber". Click OK.
7. Add yet another action, this time choose the "Update list item" action. Click the link in the new action, "update list object in this list". This brings up another dialog, in the "List" drop down, select "Unique Numbers". Click the "Add" button just below to the right, and in the new dialog's first drop down ("Set this field:"), select "LastNumber" and to the right of the "To this value:" text box, click the formula button. Again, a new dialog appears, in the "Data Source" dropdown, select "Workflow data" and then in the "Field" drop down, select "Variable: mNumber". Click OK twice to get back to the "Update list item" dialog. Now, once again in the "Find list object" section, select "Unique Numbers:Title", and type in the value CUSTOMERNO. SPD will give a warning again, click "Yes".
8. That's it. Click the "Finish" button, and if all is well, the workflow will be created.

Now, everytime you add a new item to the "Customers" list, this workflow will run and assign an auto-incrementing number to the "CustomerNo" field.

28 October 2009

New iPod Touch

I got a new Touch. It works realy great! I use it for lots of things. Email, blogging, photos (to bad there is no camera), reading books, oh and music. There are many apps and games for it too.

28 July 2009

"Put the Big Rocks in First"

By Kendall Hicks



One day, an expert in time management was speaking to a group of business students. To drive a point home, he used the following life-changing illustration. He stood before the group of high-powered overachievers and said, "Okay, time for a quiz," then he pulled out a one-gallon, wide-mouth Mason jar and set it on the table in front of him. He also produced a dozen fist-sized rocks and carefully placed them, one at a time, into the jar. When the jar was filled to the top he asked, "Is this jar full?"

Everyone in the class yelled, "Yes." The time management expert replied, "Really?" as he reached under the table and pulled out a bucket of gravel. He dumped some gravel in and shook the jar causing pieces of gravel to work themselves down into the spaces between the big rocks. He then asked the group once more, "Is the jar full?"

By this time the class was on to him. "Probably not," one of them answered. "Good!" he replied. He reached under the table and brought out a bucket of sand. He dumped the sand in the jar and it went into all of the spaces left between the rocks and the gravel. Once more he asked the question, "Is this jar full?"

"No!" the class shouted. Once again he said, "Good." Then he grabbed a pitcher of water and poured it in until the jar was filled to the brim. After this, he asked, "What is the point of this illustration?"

One eager beaver raised his hand and said, "The point is, no matter how full your schedule is, if you try really hard you can always fit some more things in it!"

"No," the speaker replied, "that's not the point. The truth this illustration teaches us is: If you don't put the big rocks in first, you'll never get them in at all!"

What are the "BIG ROCKS" in your life? In other words, what things in your life are most important? Are you allowing the urgency of gravel, sand and water to fill your life before you take time for your family, your spiritual and physical well being and your friends? If we don't put these BIG ROCKS in first, we'll never get them in at all.

E.M. Gray, who spent his life searching for the one denominator that all successful people share, stated that the one factor that seemed to transcend the rest was that successful people put first things first. In other words, successful people begin each day by taking care of the BIG ROCKS before they deal with the gravel, sand and water.




Are the BIG ROCKS in Your Mason Jar?

21 July 2009

The Law of the Garbage Truck

One day I hopped in a taxi and we took off for the airport. We were driving in the right lane when suddenly a black car jumped out of a parking space right in front of us. My taxi driver slammed on his brakes, skidded and missed the other car by just inches! The driver of the other car whipped his head around and started yelling at us. My taxi driver just smiled and waved at the guy. And I mean he was really funny. So I asked, "why did you just do that? That guy almost ruined your car and sent us to the hospital!" This is when my taxi driver taught me what I now call, "The Law of the Garbage Truck."

He explained that many people are like garbage trucks. They run around full of garbage, frustration, anger, disappointment. As their garbage piles up, they need a place to dump it and sometimes they'll dump it on you. Don't take is personally. Just smile, wave, wish them well and move on. Don't take their gargabe and spread it to other people at work, at home or on the streets. The bottom line is that successfull people do not let garbage trucks take over their day. Love the people who treat you right. Pray for the ones who don't. Life is ten percent what you make and ninety percent how you take it.

A co-worker sent this to me and I thought it was good.

12 January 2009

Books

I have and still do enjoy reading. Over the last 30 years I have read a lot of books, and I have a few recommendations:
• The Bible – Inspired by God
• Odyssey - Homer (Translated by Richmond Lattimore)
• A Connecticut Yankee in King Arthur's Court - Mark Twain
• The Rolling Stones - Robert A. Heinlein
• Sherlock Holmes – Arthur Conan Doyle
• The Hobbit – J.R.R Tolkien
• Around the World in 80 Days – Jules Verne