Wednesday, April 29, 2009

iFilter Not Working After Applying Microsoft Update

After applying any Microsoft Update, in this case we were applying the February Cumulative patches for WSS and SharePoint, that your Foxit PDF IFilter has stopped working. I'll wait while you go perform a search and notice you are not getting the expected results. You can even build the index and notice that it's building in record time!

Well, the resolution for this is quite simple. First get your install documentation that you originally used to install Foxit PDF IFilter and make sure you note the way that your IFilter is currently configured. Now, all you need to do is uninstall the Foxit PDF IFilter and reinstall. If you attempt to just reinstall/repair you will get error messages.

Monday, April 27, 2009

Sharepoint 2007 version query

Ok, so you might wonder how to tell what version your Sharepoint 2007 farm is? Sometimes the Central Admin screen can show one thing, while dll's show a different thing, and even running a patch to completion doesn't necessarily mean you were upgraded (I found that out the hard way). The best way for sure is to query the database, and it will tell you where you started, where you've been and where you are currently.

Run this query against your SharePoint Config Database:
SELECT version FROM .dbo.versions

You will see several lines in the results, hopefully more than 4, if you dont see 5 at least, you need some patches in a bad way. Here are some of the results you may see for cumulative updates and service packs.
Service Pack 1
Version: 12.0.0.6219
3.0.7.0 (initial Database Schema)
3.0.10.0 (Current databas schema)

Service Pack 2
Version: 12.0.0.6421
3.0.8.0 (initial Database Schema)
3.1.3.0 (Current Database schema)

April Cumulative
12.0.0.6504
3.0.8.0  (initial Database Schema)
3.0.10.0 (Current Database schema)

Thursday, April 2, 2009

Cascading Dropdown Lists in InfoPath 2007

This one has come up a couple of times for me. Basically, it’s the need to create a series of filtered drop-down lists in an InfoPath form that ultimately populates a read-only text box control. A logical example would be choosing a car manufacturer, then selecting the car type and then color and finally putting the price in the test box. Here’s a simple method of doing this exact thing using some simple XML and InfoPath 2007. Keep in mind through this exercise, I’m going to present it the long way to make it easier to understand.

  1. Open InfoPath 2007
  2. Under the Design a form heading, select Design a Form Template
  3. Select Blank and then click OK. Make sure you UNCHECK the box next to, Enable Browser-compatible features only before clicking OK
  4. From the Design Tasks Pane, select Controls
  5. Insert two (2) Drop-Down List Box controls and one (1) Text Box control. Note: you can either drag and drop the controls onto the form page, or you can simply click on the control to have it automatically insert. You can change the formatting later. At this point, if you click on Controls, in the Design Task pane, you can select Data Sources. You will notice a Main data source with a group folder called myFields. Under the group folder you will notice the fields which were entered above, automatically created, automatically named and the data types defaultedto text. These data fields are uniquely bound to each control inserted.
  6. Double-click on the first Drop-Down List Box control, which should be named field1 as default, to open the Drop-Down List Box Properties
  7. With List box entries set to Enter list box entries manually, click Add…
  8. Add, Ford and then GM and then Lexus, then click OK
  9. Now, open a Microsoft Notepad (click Start->All Programs->Accessories->Notepad), this seems to be the easiest method to put the XML datasource together. What we want to be able to do is filter on the manufacturer Drop-Down List that you defined above as Ford, GM or Lexus. What we want to return is the model and then the price for that model. For this exercise, we’ll use four (4) XML tags, as follows. NOTE: XML Tags are useually in pairs, an opening and closing tag, referred to as a tag pair. All data that belongs to a specific element will be appearing within this tag pair. In our case, we will be embedding tag pairs within tag pairs to define data all the way to the price:

  10. <AUTOINDUSTRY></AUTOINDUSTRY>
    <AUTOMODELS></AUTOMODELS>
    <MODEL></MODEL>
    <PRICE></PRICE>
    We’ll also use a tag called AUTOMAKER that will be defined later.

  11. Now we can setup the XML in the Notepad to be able to filter data and return a value, in this case the price. First we’ll add the filters for Manufacturer, but we need to format the XML tags. First put in the AUTOINDUSTRY tag pair. This will represent the start and finish of the XML:

  12. <AUTOINDUSTRY>
    </AUTOINDUSTRY>

  13. Now Insert the AUTOMODELS tag pair inside the AUTOINDUSTRY tag pair. Between these tags is where the logic we are going to use will be embedded:

  14. <AUTOINDUSTRY>
    <AUTOMODELS>
    </AUTOMODELS>

    </AUTOINDUSTRY>

  15. Now we need to setup the filters from the dropdown selection from the list we created earlier, this is also where we define the AUTOMAKER tag listed above:

  16. <AUTOINDUSTRY>
    <AUTOMODELS AUTOMAKER="Ford">
    </AUTOMODELS>
    <AUTOMODELS AUTOMAKER="GM">
    </AUTOMODELS>
    <AUTOMODELS AUTOMAKER="Lexus">
    </AUTOMODELS>
    </AUTOINDUSTRY>

  17. Next we’ll add the models tag pair for the selected manufacturer inside the AUTOINDUSTRY tag pair

  18. <AUTOINDUSTRY>
    <AUTOMODELS AUTOMAKER="Ford">
    <MODEL>Mustang</MODEL>
    </AUTOMODELS>
    <AUTOMODELS AUTOMAKER="GM">
    <MODEL>Corvette</MODEL>
    </AUTOMODELS>
    <AUTOMODELS AUTOMAKER="Lexus">
    <MODEL>IS</MODEL>
    </AUTOMODELS>
    </AUTOINDUSTRY>

  19. Finally, we’ll add the price for the selected model

  20. <AUTOINDUSTRY>
    <AUTOMODELS AUTOMAKER="Ford">
    <MODEL>Mustang</MODEL>
    <PRICE>20,000</PRICE>
    </AUTOMODELS>
    <AUTOMODELS AUTOMAKER="GM">
    <MODEL>Corvette</MODEL>
    <PRICE>30,000</PRICE>
    </AUTOMODELS>
    <AUTOMODELS AUTOMAKER="Lexus">
    <MODEL>IS</MODEL>
    <PRICE>30,000</PRICE>
    </AUTOMODELS>
    </AUTOINDUSTRY>

  21. To add multiple Models, we’ll have to copy an entire AUTOMODELS tag, we’ll add one for this example:

  22. <AUTOINDUSTRY>
    <AUTOMODELS AUTOMAKER="Ford">
    <MODEL>Mustang</MODEL>
    <PRICE>20,000</PRICE>
    </AUTOMODELS>
    <AUTOMODELS AUTOMAKER="Ford">
    <MODEL>Focus</MODEL>
    <PRICE>10,000</PRICE>
    </AUTOMODELS>

    <AUTOMODELS AUTOMAKER="GM">
    <MODEL>Corvette</MODEL>
    <PRICE>30,000</PRICE>
    </AUTOMODELS>
    <AUTOMODELS AUTOMAKER="Lexus">
    <MODEL>IS</MODEL>
    <PRICE>30,000</PRICE>
    </AUTOMODELS>
    </AUTOINDUSTRY>

  23. Now, save the file that you’ve been working on to your local machine and name it auto.xml
  24. Back in the InfoPath form, double-click the second drop down control, which should be field2 and to open the Drop-Down List Box Properties box
  25. Under List Box Entries, select Look up values from an external data source and then click Add
  26. Select Create a new connection to: and select Receive data and click Next
  27. Select XML Document and click Next
  28. Click Browse and then select the auto.xml file we created earlier and click Next
  29. Select Include the data as a resource file in the form template or template part and click next
  30. Enter the name auto in the field provided for Enter a name for this data connection and check the box next to Automatically retrieve data when form is opened and click Finish
  31. Next to Entries, back on the Drop-Down List Box Properties, click the Select XPath button (this looks like a little + with a document next to it, just to the right of the box)
  32. On the Select a Field or Group popup, select AUTOMODELS and then click Filter Data…
  33. Add a new filter, by clicking Add…
  34. Change the first dropdown box to AUTOMAKER. This is the tag we created earlier in the XML file. This will compare what has been selected to what is in the XML file for filtering purposes.
  35. The second drop down should be is equal to
  36. On the third drop down select, Select a field or group
  37. Change data source to Main and select field1 and click OK
  38. The third drop down should now display field1, click OK to accept the filter rule
  39. Click OK to accept the new filter
  40. Click OK to accept the Xpath
  41. Click the XPath button next to Value and change it to PRICE and click OK
  42. Click the XPath button next to Display Name and change it to MODEL and click OK
  43. Click OK to accept the new property changes.
  44. Finally, on the Text Box, double click on it to open the Text Box properties, this should be field3
  45. Next to Value, select the Xpression button to open the formula box (this should look like an F with a small x to the right of the box)
  46. Click Insert Field or Group and select field2 from the Main data source
  47. Click OK, to accept the selection
  48. Click OK to accept the formula
  49. Click Apply to accept the changes
  50. You can now click the Preview button to test the form or you can also click File->Preview->Form, which will do the same thing

What you have essentially done is, setup one dropdown list loaded with values. Based on the selection that you make on that initial drop down list, you are comparing it to values in the XML, in this case AUTOMODELS. Every instance of AUTOMODELS which matches the selection from the initial drop down list is then pushed into the second drop down. Then, based on your selection of that filtered list, an additional value is pulled, in this case, the price that we set on the models. We then display the model to the user and store the price as the value. Finally, we pass the set value into the text box to display the price.

Additionally, you can set some conditional formatting on the second drop down to disable the control if the first drop down is blank. You could also change the display properties on the Text Box to make it read-only. In this manner, the user would have to select a manufacturer before they could select a model and there’s no way for them to change the price. You can also do some formatting to clean up the value in the second dropdown to render information that's relevant to the first choice. Good Luck!