15 Mar

How to remove link for SharePoint lookup column from a DataView WebPart using XSLT

Whenever we use a lookup column into the dataview or listview, it displays a link to the lookup item it is referring to. This is the same behavior you see on the backend list views. But sometimes we just need to show data on page and do not need the link to the lookup item.

Setting disable-output-escaping="no" doesn’t work in this case, because then it displays the HTML coding for the link (‘a’ tag).

The easiest solution to get rid of ‘A’ tag is to remove it completely using sub-string function.

For example if you are showing a column named “Category”, in this case you can replace

<xsl:value-of select="@Category" disable-output-escaping="yes"/>

 

with

 

<xsl:value-of select="substring-before(substring-after(@Category, ‘&gt;’), ‘&lt;’)" disable-output-escaping="yes"/>

29 Jan

How to create a custom sequential number field in MOSS list?

I recently came across a requirement where in customer wanted to auto generate a custom sequential number with current date as a part of this sequential number on a SharePoint list.

Although SharePoint has an inbuilt “ID” field and Issue Tracker list can Issue ID. But they simply just provide running numbers like 1, 2, 3, 4.What if you need some prefix and also a choice from where the sequential numbers should start.

You can achieve this through different approaches, like using an event handler etc., but I think the following is the simplest of all.

Here is the step by step instructions on how to get this done.

There are two parts for this solution.

Part 1: Getting the desired sequential number

1. First of all we need to create a list which will help us in generating the numbers, let us call this list as “Unique Numbers”

2. Add one number field, “LastNumber” and one calculated field “NextNumber” to this list. The formula to be used for NextNumber is “[LastNumber]+1″(Note: The data type returned from this formula should be number)

3. Let us add a new Item to this list with the following information

Title : ORDERNO

LastNumber : 99

4. Now we need to create the second list I will call it “Orders”

5. Add a number field “OrderNo” to this new list, now we are ready to build the workflow to generate unique sequential numbers

6. Open your web site in SharePoint Designer (SPD) .Create a new workflow. In the File menu, select New->Workflow…

7. In the dialog that appears, give the workflow a name, e.g. “Assign Order Number”. In the drop-down list below, choose to connect the workflow to the list you want to assign auto sequential numbers to (In this case, this would be a list called Orders). Then check the middle option of the three check boxes below, “Start this workflow automatically when a new item is created”.

8. 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.

9. 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 (“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 ORDERNO. Click OK. SPD will now give a warning that the look up might return more than one value, just select “Yes” to continue here.

10. Now you add one more action. Click the “Actions” button and select “Set field in current object”. 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. “OrderNo”). 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.

11. 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 ORDERNO. SPD will give a warning again, click “Yes”.

12. That’s it. Click the “Finish” button, and if all is well, the workflow will be created.

13. Now when you create a new item in the Customers list you will see that a unique sequential “OrderNo” is generated

Now we have achieved our first goal of generating a desired sequential number. Now on to Part 2

Part 2: Adding a prefix to the sequential number, in this case current date in YYYYMMDD format

1. Create a field “Today’s Date” this should be of “Date and Time” type and default value should be today’s date.

2. Create another field “OrderID” of calculated type and use this formula

=TEXT(Today’s Date,”yyyymmdd”)&OrderNo

Now when you create a new item on Orders list you will see that a new OrderID is generated .

Note: The field names mentioned here for example purpose, you can use any name with the same logic to make it work.

18 Jul

Best mobile wallet application I would recommend

Far away from Microsoft and Google technologies, this is the first time I’m going to write about some product. Recently I brought a new handset and I started out searching third party applications that are available for the same.

Along with some games, opera mobile browser, gmail, nimbuzz (or skype) what I always need is a good mobile wallet application which will store my banking details, credit card details, ATM pins, some secret notes, etc.

Previously I use to store all this information into password protected notes, but recently when my friend from South Africa become victim of some spyware and lost his PayPal balance, I got more serious about the security of my data in my PC and in my mobile. I realized that I need some tool which will store my sensitive information in an encrypted format which is not easy to break.

So I started my journey to search a tool which will keep my data secure in my mobile. After trying around 5-6 products, I came across a wallet application which promised all. I said “promised” because many tools promise a lot and perform much lesser. The promises were high, so I decided if this tool is able to keep it words then I’ll surely recommend it to my readers.

Mobile Wallet Login ScreenNow when I’m using this tool on my mobile and PC (yes PC too) from last 6 months and I’m completely satisfied with it, its time I should introduce it to you guys.

The tool is SPB Wallet from SPB Software

Using SPB Wallet, I can not only store my banking/credit card details, i can store them in a categorized fashion. All the information is encrypted using Strong 256-bit AES encryption.  All the data is password protected and they have their own click keyboard which keeps key Loggers (viruses which steal your data by logging your keys) guessing what you are typing. So this satisfied my purpose of having a tool which will keep my data extremely secure. More over if you forget to close the application, it locks up automatically. Man, this is amaaaazing…

Desktop Secure ApplicationThe best part is it also has a desktop tool which comes in the same package, which installs on your desktop and you can synchronize the data between your mobile and desktop. It also integrates with browser and then you can choose to store your email/website passwords into the wallet so that when next time you forget them, you can check them into the wallet.

Another security feature I love the most is, it doesn’t show the pins/passwords directly on the screen instead it shows **** and when you click on the stars, it reveals your password to you.

Icing on the cake:
Above all, it has a very nice UI which gives a very rich experience. See some screen shots below

Things I didn’t like about SPB Wallet:

  1. While using the desktop application, and when you have connected your mobile using Bluetooth, you need to click on the Sync button twice or thrice. But being a programmer I can understand that this must be a phone-PC connectivity issue so we cannot blame the coders of this application :-)
  2. ‘Search’ is the feature which is used less, so instead of giving ‘search’ button, if they would have had ‘Exit’ then it would have saved time. Now you always need to choose ‘Exit’ from the menu. But this may be my personal view.

Bad news: This is not for those who believe that best things in life are free. It has some moderate price. But I think it is worth than becoming a victim of viruses and loosing your bank balance and getting huge credit card bills. My purpose of buying SPB Wallet was – being a user of online banking, I wanted to protect my financial information.

You may find more information about the feature here
http://www.spb.com/symbian-software/wallet/