in

InfoPath Dev

David Airapetyan

Codeless way of getting DBXL document properties (docid, doctype and DBXL URL)

A DBXL solution that is designed to be generic needs to be able to access several DBXL properties. For example, a solution that wants to display a hyperlink in an e-mail needs to be able to determine its docid and the DBXL URL.

While it's easy to write code to retrieve this data, it is often not desirable to do so. For instance, browser-based solutions are much harder to deploy when they contain code.

This post describes a way of getting this information using only rules. Here is what you need to do:

To get the DBXL document ID, add a docId field to your data source and set it on load via this rule:
substring-before(substring-after(processing-instruction()[local-name(.) = "QdabraDBXL"], 'docid="'), '"')

Note that this value will not be set for a new document

To get the DBXL URL, add a url field to your data source and set it on load via this rule:
substring-before(substring-after(processing-instruction()[local-name(.) = "mso-infoPathSolution"], 'href="'), "/Forms")

Finally, to get the DBXL document type, add a doctype field to your data source and set it on load via this rule:
substring-before(substring-after(processing-instruction()[local-name(.) = "mso-infoPathSolution"], concat(url, "/Forms/")), "/template.xsn")

Note how the last rule builds on the url value we've gotten previously.

It is important to understand that these rules will only work after the InfoPath solution has been published to DBXL.

You can download a full sample here: http://www.infopathdev.com/files/folders/community_uploads/entry30638.aspx

Comments

No Comments

About davidair

I am a Computer Science graduate from McGill University in Montreal, Canada. I have over seven years of industry experience including almost five of them spent with the Microsoft Corporation where I shipped several versions of Microsoft Office InfoPath. Originally from Russia, I am fluent in several languages, including Russian, English, French, C#, C++ and Perl. I currently reside in Montreal and work for Qdabra Software.
Copyright © 2003-2007 Qdabra Software. All rights reserved.
View our Terms of Use.