Saturday, October 21, 2006

Missing nodes from a webservice.

InfoPath is very particular about the type of document it processes - this due to its very stringent implementation of XSD Schemas. InfoPath will complain immediately if it encounters nodes that do not fit the schema design (nodes not defined in schema, nodes out of position, multiple nodes where not defined as repeating)

If a node is missing from the instance document and the schema dictates the optional presence of this node, InfoPath will accept the document as valid. However, if there are any controls being bound to the missing field, InfoPath will disable the field in the UI, as nothing can be written to a missing node.

This became painfully apparent in our early iterations of our InfoPath form. We noticed several fields being locked out in the form only to discover the fields were missing from the XML documents returned by our Webservice. We tracked this down to the Enterprise Library's Database Datatable to XML conversion.

Any null values in a recordset are not converted to empty fields in the resulting XML, but rather they are just omitted. Our solution was to use the schema to build ourselves an empty instance document and populate it with the data from the recordset. This way we are guaranteed to get all required nodes returned from a webservice

Since a schema document is simply another XML document, parse the XSD document and programmatically build the instance document starting from the root node element definition.. TBC

Friday, October 13, 2006

Extracting form files
  1. Choose Extract Form Files from the File menu.
  2. Select a location to save your extracted form files to, and then click OK.
  3. Close InfoPath to release the lock it places on your form files.
  4. Using a text editor, open your view .xsl file.

Friday, October 13, 2006


Breaking In A New Horse

One of the growing pains I encountered after migrating to Visual Studio 2005, was an issue I had trying to debug my InfoPath 2003 project. I would get an error message;
"In order to debug this project, add an executable project to this solution which references the library project. Set the executable project as the startup project."

While VS 2003 would launch the InfoPath form and Debug it with a fancy-free click of the 'Debu' button, VS 2005 requires you to have the solution selected before it will attempt to launch the form.

However that brought me to an issue I was not previously having. Without having changed any code, the form failed to load in preview or debug mode. Now I am getting the “The format of the file .dll is invalid” error. You would see this error on our dev-test VPCs that did not have the .NET 2.0 framework installed prior to launching the new form.

How is it possible that the DEV workstation compiling the formcode.cs in Visual Studio 2005 .NET 2.0 did not have .Net 2.0 installed?!?

After a quick reinstall of the framework and a restart, the form is debugging and previewing again.

So in recap; select the solution item in the Solution Explorer of Visual Studio 2005 BEFORE attempting to debug (F5).

Ciao for Niao

Thursday, October 12, 2006

The project I'm currently working on finally afforded the time to convert the project from 2003 platforms to 2005 servers and .NET 2.0. While many of my collegues in other companies made the change last year, we are a consulting firm doing work for clients and so we required approval from the customer to proceed.

So far the InfoPath conversion was rather painless as we are not migrating to Office 2007 (yet?). The managed code compiled beautifully in Visual Studio 2005 and after installing the .Net 2.0 Framework on the test workstations, the form opened without flaw. However the webservices needed to be migrated to another machine name to not conflict with Sharepoint Services which are still running 1.1.4.

Our form displays a simple windows form with a rotating graphic scheme as a “Please Wait” message. Initially, a couple of them got stuck on the display and new ones stop showing up. Not sure what the cause was, but it seems to have corrected itself - perhaps the first load of the new form in .NET 2.0?

Other than that things went very well from my end. Next on the migration for me is Notification Services. Another breeze I expect.

Ciao for Niao

Monday, September 11, 2006

The Great Giveaway continues...

Ever tried to get unique items out of the events table in SQL Notification Services?

Use the greatest EventBatchId with EventCount greater than 0 from the EventBatches table, to identify the latest set of events written to the Events table.

The Current Events table will have the events trapped by the events query at runtime, however the records are temporary and get dumped to the events table. The above method is the best way to locate the latest events.

Ciao for Niao

Friday, September 08, 2006

Ever tried updating a solution from Source Safe and get a dialog box asking to redeploy a website/virtural directory to another location? (usally the same name suffixed with an underscore and a number)

Well, to redeploy the website to the same URL, go to the directory and delete the project file (*.csproj or *.vbproj...). You may then go back to the dialog box and fix the URL to publish back to the original path. The project will deploy successfully.

Friday, August 18, 2006

YES/NO/CANCEL

I recently received an issue from our diligent QA department asking to have a dialog box, which presented Yes/No/Cancel as options, shortened down to just Yes/No

I responded with my reason for the existance of this combination of options:

It is a UI decision. Both Yes and No are definitive answers to a question, however, sometimes a user will interact an application and perform actions that they had no intentions of doing.
Definitive answers like Yes and No imply that you are instructing the application to do something (even if you answer no). Because you answered the question, the application is going to take action accordingly.

The Cancel option gives the user peace-of-mind that, if they just cancel, nothing will happen because they have just instructed the application to "cancel" the previous action all together.

Of course wording the question is crucial here. The question could very well imply that clicking No means that the action will be cancelled. However with a very critical action, a user may feel more at ease indicating to the application to completely disregard the previous action, even if No does mean NO!

Wednesday, August 16, 2006

One of the most useful pieces of code used by the InfoPath Developers here at Visiphor is the SecondaryDataSource Class written by one of our senior developers, Keith Curtis.

This class exposes some simple methods which we use to interact with secondary data sources.
  • Call the secondary datasource (query()),
  • Query data (GetNodeValue(), GetValue())
  • Set data (SetNodeValue).
All of the clutter of handling a secondary datasource in code (namespacing, instantiating the connection, etc.) are handled from within the class. The developer need only instanciate the class, by passing the name of the secondary data source and the XDocument, to have access to these very simple tools.

The GetNodeValue and GetValue methods behave more like typical XSLT xsl:value-of calls where xpath queries that result in missing nodes do not cause catastrophic exceptions, but rather return empty strings. Trace messages can be returned if the xpath query does not return a node, but the call will not fail.

We added a winform to the InfoPath form that is called by the query method. The winform displays a progress bar, which runs in a separate thread so while the form is disabled by calls to a datasource/webservice, the progress bar gives the user something to look at. Also, because the winform runs in a separate thread, it displays while the form is initially loading (before the first view is rendered) - NICE!

I'll talk more about the winform and the speed-of-load issues which spawned the need/want of the progress bar in future entries.

If you'd like more info about the class, drop me a line.

Thanks for reading,

Jessel

Sunday, July 23, 2006

It has been (now) 6 days since my first blog entry. A few people have inquired as to when the next entry will be published. Well I haven't formalized the intention of this blog, so let me simply outline the inspiration for it.

As part of the personal brand development at Visiphor, I intend to use this blog to showcase the particular niche I have found myself in and hopefully identify myself as viable resource on the topic(s).

In my time with this group, I have been exposed to a few new technologies (SQL Reporting Services, SQL Notification Services, Microsoft InfoPath). I intend on documenting our experiences and application of (at least) SQL Notification Services and Microsoft InfoPath. I am also very interested in expanding my introduction to K2.NET and its following release "Black Pearl"

The InfoPath form I am currently working is very exciting and full of interesting applications of the technology, which I plan on displaying. I will also provide a few "nice to have" features which we have not implemented and how to implement them.

That's all for now...

Thanks

Jessel Aquing

Monday, July 17, 2006

Hello all!

Yes, that does include you.

This constitues my first blog entry - ever. As my first blog entry I choose to focus mainly on the fact that this is my first blog entry. While I have plenty to say, I have never had a problem finding an audience (willing, unwilling, captive or evasive). So this blog will serve as a log of of my adventures in Enterpise Solution Development at Visiphor Consulting Services here in beautiful Vancouver, British Columbia, Canada.

The next entry will document in more detail the intentions of this Blog.


Thanks!

Jessel