Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General MS InfoPath Questions / August 2004

Tip: Looking for answers? Try searching our database.

DataInterop Sample - Dynamically changing Binding?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Matthew Ortiz - 17 Aug 2004 22:51 GMT
I've got an InfoPath form that requires work offline.  In other words, the
users will grab the InfoPath form originally from a URL, open the form, the
form executes the DataObject query and caches the data.  I've done this
successfully using the DataInterop sample.  

Now when the user saves the form locally and then re-opens the form when
offline the data is cached, it can be seen if you open the saved form in a
text editor, but the repeating section that contains a repeating table that
is bound to the original data object no longer binds.  This isn't surprising;
however, I now need to change the binding of the repeating section and the
contained repeating table so that the cached data is now used to bind to.  

I have not found how this is happening in the DataInterop sample.  However,
in testing the sample I’ve opened the form, queried on the Employee, and then
click the Offline button.  This caches the data, the same way that I do in my
app, and then prompts the user to save the file for offline use.  The form is
then closed and the SQL Server service is stopped.  I then re-open the form
and after a while waiting for the time out on the DataObject query execution
the cached data now shows up in the drop-downs.  How is this being done?  
I’ve obviously got a bit more complicated binding going on but how is the
data binding being changed to look at the cached data?  

If I take a look at the OrderDetails.xsl I can see where I think the
‘xdComboBox’ is original bound to the DataObject (e.g.
‘xdXDocument:GetDOM("Employees")/dfs:myFields/dfs:dataFields/d:Employees’)
but the question remains how is control then changed to bind to the cached
data?

Can somebody provide any help on this?  This seems to be something that
would be obvious but I’m not getting it.

I appreciate any support,

Matthew Ortiz
Rick Severson [MSFT] - 17 Aug 2004 23:44 GMT
Dynamically changing the binding of a control could be tricky.  You might
try to have 2 identical repeating controls bound to two different sources.
One bound to the online data source and the other to an offline source.
Using rules and conditional formatting, you can show/hide the unused
control.  Since the controls look the same, it gives the appearance of one
control.

In the OnLoad function, you could do a check for
Application.MachineOnlineState and only query the secondary data source for
the online version if this returns true (this way the user is not waiting
for a connection to time out just to find out they are off line).

Then, prior to leaving OnLoad, if you are online, you could update the cache
file from the online data source to the offline data source.

> I've got an InfoPath form that requires work offline.  In other words, the
> users will grab the InfoPath form originally from a URL, open the form, the
[quoted text clipped - 10 lines]
> I have not found how this is happening in the DataInterop sample.  However,
> in testing the sample I've opened the form, queried on the Employee, and
then
> click the Offline button.  This caches the data, the same way that I do in my
> app, and then prompts the user to save the file for offline use.  The form is
[quoted text clipped - 16 lines]
>
> Matthew Ortiz
Steve van Dongen [MSFT] - 18 Aug 2004 22:04 GMT
>I've got an InfoPath form that requires work offline.  In other words, the
>users will grab the InfoPath form originally from a URL, open the form, the
[quoted text clipped - 26 lines]
>Can somebody provide any help on this?  This seems to be something that
>would be obvious but I’m not getting it.

The DataInterop sample doesn't change bindings.  Look at the
LoadAuxiliaryDOMs function and where it's called in the OnLoad
handler.  LoadAuxiliaryDOMs is called once and it calls Query on the
DataObjects.  If it works, cool, if not then LoadAuxiliaryDOMs is
called again with the true parameter which causes it to copy the
cached data into the secondary datasource DOMs.

As Rick says, in SP1, it would be better to use the new
Application.MachineOnlineState property than waiting for the queries
to timeout.  The OnLoad would basically look something like this:

gblnOnline = Application.MachineOnlineState;
LoadAuxiliaryDOMs(!gblnOnline);
if (gblnOnline)
{
    if
(XDocument.DOM.selectSingleNode("/dfs:myFields/dfs:queryFields/q:Orders/@EmployeeID").text
== "")
    {
        XDocument.ViewInfos("Query").IsDefault = true;
    }
    else
    {
        XDocument.ViewInfos("Orders").IsDefault = true;
    }
}
else
{
    XDocument.ViewInfos("Orders").IsDefault = true;
}

Regards,
Steve
--
Please post questions to the newsgroup; everyone benefits.
This posting is provided "AS IS" with no warranties, and confers no rights.
Sample code subject to http://www.microsoft.com/info/cpyright.htm
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.