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 / January 2006

Tip: Looking for answers? Try searching our database.

Alternative to UI.Alert

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
BethA - 13 Jan 2006 17:33 GMT
I have an InfoPath form that looks up some data in a database - that's all
done in managed code behind the form. Sometimes it takes a few seconds, so I
have a UI.Alert come up to tell the user the data is being looked up, and
then another to say it's finished.

This is not ideal because I would rather not have the user have to click on
the OK button to clear the Alert and let the code continue. In Excel, I use
Application.StatusBar to give the user the status of what my macro is doing.
Is there such a thing I can do in InfoPath?

Thanks,
Beth A.
Greg Collins [InfoPath MVP] - 17 Jan 2006 00:46 GMT
Create a secondary .xml file with a status field in it. Place the status field in the view, and then instead of using Alert, just update the value of the status field, which will then display inline in the form.

Signature

Greg Collins [InfoPath MVP]
Visit http://www.InfoPathDev.com

I have an InfoPath form that looks up some data in a database - that's all
done in managed code behind the form. Sometimes it takes a few seconds, so I
have a UI.Alert come up to tell the user the data is being looked up, and
then another to say it's finished.

This is not ideal because I would rather not have the user have to click on
the OK button to clear the Alert and let the code continue. In Excel, I use
Application.StatusBar to give the user the status of what my macro is doing.
Is there such a thing I can do in InfoPath?

Thanks,
Beth A.
BethA - 17 Jan 2006 15:38 GMT
Thanks Greg - this was really helpful, and like most good ideas, obvious once
I read it! I put the field right into my schema rather than create a
secondary one.

The only problem is that I'm using managed code in the OnAfterChange event
and it doesn't update the fields immediately on the form. Anyway to get it to
update immediately. I tried to make a rule to do it, hoping that the rule
would occur first. It doesn't seem to work though. I want the status field to
be blank after the data has been retrieved from the secondary data source.

Thanks,
Beth A.

> Create a secondary .xml file with a status field in it. Place the status field in the view, and then instead of using Alert, just update the value of the status field, which will then display inline in the form.
>
[quoted text clipped - 10 lines]
> Thanks,
> Beth A.
Greg Collins [InfoPath MVP] - 17 Jan 2006 17:32 GMT
Yes, you are running into the issue where the view field is not refreshed until the function exits.

There is a function that forces the view to update [ XDocument.View.ForceUpdate(); ]... but I don't recall having a whole lot of luck with it in situations like this either. Give it a try though and see if it helps.

The problem, as I mentioned, is not that the field is not being updated, but that the view is not being refreshed--at least not until the function exits.

Signature

Greg Collins [InfoPath MVP]
Visit http://www.InfoPathDev.com

Thanks Greg - this was really helpful, and like most good ideas, obvious once
I read it! I put the field right into my schema rather than create a
secondary one.

The only problem is that I'm using managed code in the OnAfterChange event
and it doesn't update the fields immediately on the form. Anyway to get it to
update immediately. I tried to make a rule to do it, hoping that the rule
would occur first. It doesn't seem to work though. I want the status field to
be blank after the data has been retrieved from the secondary data source.

Thanks,
Beth A.

"Greg Collins [InfoPath MVP]" wrote:

> Create a secondary .xml file with a status field in it. Place the status field in the view, and then instead of using Alert, just update the value of the status field, which will then display inline in the form.
BethA - 17 Jan 2006 17:46 GMT
I've been trying to get the ForceUpdate method to work, but it's not doing
anything. Will this work better if I go with the secondary datasource XML
file and query from there? I didn't want to full around with all the extra
machinery (especially figuring out how to access the secondary datasource in
code), but I will if I have to.

Thanks,
Beth A.

> Yes, you are running into the issue where the view field is not refreshed until the function exits.
>
[quoted text clipped - 18 lines]
>
> > Create a secondary .xml file with a status field in it. Place the status field in the view, and then instead of using Alert, just update the value of the status field, which will then display inline in the form.
Greg Collins [InfoPath MVP] - 18 Jan 2006 00:54 GMT
As I said, I never had any luck with that either. It is completely a timing issue. The secondary data source will make no difference in this case. I don't think I've ever figured out how to make it work.

One thing that might work (never tried it) is to have a custom task pane, and to do your messages in there. This probably doesn't have the same refresh issues that the main view has.

Signature

Greg Collins [InfoPath MVP]
Visit http://www.InfoPathDev.com

I've been trying to get the ForceUpdate method to work, but it's not doing
anything. Will this work better if I go with the secondary datasource XML
file and query from there? I didn't want to full around with all the extra
machinery (especially figuring out how to access the secondary datasource in
code), but I will if I have to.

Thanks,
Beth A.

"Greg Collins [InfoPath MVP]" wrote:

> Yes, you are running into the issue where the view field is not refreshed until the function exits.
>
[quoted text clipped - 3 lines]
>
> > Create a secondary .xml file with a status field in it. Place the status field in the view, and then instead of using Alert, just update the value of the status field, which will then display inline in the form.
BethA - 18 Jan 2006 17:56 GMT
Thank you Greg - I got this to work with the custom task pane. I did it very
simplisticly - made an HTML file with my message in Word, set it the task
pane as invisible in the OnSwitchViews event handler. Then in my
OnAfterChange handler, I make the custom task pane visible before running my
"getdata" procedure, then invisible again at the end.

That was quick way to do it - I would have to think harder if I wanted more
than one message coming up, or other features of the custom task pane.

Beth A.
Greg Collins [InfoPath MVP] - 19 Jan 2006 16:16 GMT
Perhaps not the most elegant solution, but I'm happy to hear that you got it working!

Signature

Greg Collins [InfoPath MVP]
Visit http://www.InfoPathDev.com

Thank you Greg - I got this to work with the custom task pane. I did it very
simplisticly - made an HTML file with my message in Word, set it the task
pane as invisible in the OnSwitchViews event handler. Then in my
OnAfterChange handler, I make the custom task pane visible before running my
"getdata" procedure, then invisible again at the end.

That was quick way to do it - I would have to think harder if I wanted more
than one message coming up, or other features of the custom task pane.

Beth A.
 
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.