When is a default view not a default view? - InfoPath Dev Sign in | Join | Help in General InfoPath (Entire Site) InfoPath Dev InfoPath Dev is dedicated to bringing you the information and tools you need to be successful in your Microsoft Office InfoPath development projects. Home Blogs Forums Photos Downloads InfoPath Dev » InfoPath » General » When is a default view not a default view? When is a default view not a default view? Last post 11-24-2004 08:24 AM by Greg Collins. 12 replies. Page 1 of 1 (13 items) Sort Posts: Oldest to newest Newest to oldest Previous Next 11-16-2004 03:45 AM jonbrave Joined on 10-15-2004 United Kingdom Posts 59 When is a default view not a default view? Reply Contact I'm stumped on this one...Developing a form. It had one view. I introduce a second view, and set that as default view. Works fine when accessed from any machine. Except... On my machine (where I develop), the original view gets shown first. Believe me, I have tried everything: resetting, resaving, rebooting, starting from either "open" or "design" mode ... If I place a debugger statement in MS Script OnLoad() event and run on my machine, I can see it says the *original* view is the default, so no wonder. But where's it getting that from: I can see quite clearly that I have set the new view as default? The only thing I can think of is a cached copy/saved setting somewhere/somehow?I have checked I do not have any load rules, user views etc. For now, I have created a rule in "Form Options" for "Open behaviour" telling it to switch to the other view, and that gets my by, but what the heck?... 11-18-2004 10:53 AM In reply to Greg Collins Joined on 08-07-2006 Posts 2,126 Re: When is a default view not a default view? Mark as Not AnswerMark as Answer... Reply Contact See if this answers your question:http://www.infopathdev.com/blog/PermaLink.aspx?guid=484545b5-d9db-480f-bb88-6515f6831cebGreg Collins [InfoPath MVP] Please Visit:BraintroveGreg's Paintings 11-19-2004 01:03 AM In reply to jonbrave Joined on 10-15-2004 United Kingdom Posts 59 Re: When is a default view not a default view? Mark as Not AnswerMark as Answer... Reply Contact Unfortunately I think not...That blog says pre-SP-1, managed code, changing views in code. I'm SP-1, MS Script, and the whole point is I'm not changing views in code/rules/roles, I'm just trying to get the default view defined in the design to show up firt at runtime. Also, FWIW, I've cleared the IP cache (which the blog seemed to be about), and that's made no difference...From Andrew Watt's posts on MS forum, it seems my best is to try restarting from scratch, copying, pasting, renaming, altering, and see if I can figure...Here's an extract from the detail there:Here's the simple facts I can't explain:* In IP Design mode, I can see the Default View has been set to the *second* view I designed* I've tried Exporting Form Files, looked in manifest.xsf, and I can see line: <xsf:views default="Logon">which is correct ("Logon" is my second view)* I'm using MS Script. I break in XDocument::OnLoad() function (can't get much earlier than that...)* In debugger, I look at XDocument.ViewInfos(0 and 1).IsDefault. It shows my original (0, first) View.IsDefault = true ! So given that the behaviour isn't surprising, but how come it's set like that??? (If I change this value in debugger so second view is default, then that comes up first.) 11-19-2004 02:27 AM In reply to Patrick Halstead Joined on 08-07-2006 Posts 5,112 Re: When is a default view not a default view? Mark as Not AnswerMark as Answer... Reply Contact Hi JB,Interesting post! There was a bug in InfoPath that I discovered that was exactly like what you describe here and that's why Greg suggested reading the blog entry. It's possible that you have discovered another bug in InfoPath. You should post repro instructions so that people from MS can take a look.Cheers!Patrick Patrick HalsteadProject Manager at Qdabra 11-19-2004 05:08 AM In reply to jonbrave Joined on 10-15-2004 United Kingdom Posts 59 Re: When is a default view not a default view? Mark as Not AnswerMark as Answer... Reply Contact OK, I'm starting to look into this.Can I *please* have an answer first off to a very simple question: is "Default View" taken into account when previewing from *design* mode?In a test, I create a blank form and an extra view, i.e. "View 1" & "View 2". I set "View 2" as the default. I save.Now, I find:* if I "Open" form to fill out, "View 2" comes up* if I "Design" form and preview, then whatever view I am looking at in design mode comes upI have tried every combination of getting into Open/Design mode (from IP, from Explorer, etc. etc.) and this is always the behaviour. Open mode respects my default, from design mode does not.Is this or is this not expected behaviour?(Having said this, this still doesn't solve my original problem: in that form, it still doesn't matter what I'm viewing in design mode, or when I open, it *always* comes up one one (non-default) viw. But let's wait on that till I get an answer to this part...) 11-19-2004 07:58 AM In reply to jonbrave Joined on 10-15-2004 United Kingdom Posts 59 Re: When is a default view not a default view? Mark as Not AnswerMark as Answer... Reply Contact Greg,You said elsewhere:quote:To answer your first question... the default view *IS* taken into account during preview from the designer.And I replied:quote:Hmmmm.... So now I technically have two problems (at least on my machine) then:1. Default View is *not* taken into account for me from design mode (as per repro steps below on brand new IP form, two views, no code, nothing...)2. On real form, reagrdless design/open mode, Default View *always* ignored and set to one particular view.Inexplicable? Related? Why do I begin to feel a "uninstall & reinstall IP" coming on? ... :-)I'm happy continuing this conversation here or at InfoPathDev.com. Probably prefer the latter. Except that it's down (again)...We ought to pick one forum or the other. I like your forum @InfoPathDev.com, coz I can pretty-print and it's cosy, but I don't know whether others like Andrew Watt who's @MS Communities might be useful for input... 11-19-2004 08:08 AM In reply to jonbrave Joined on 10-15-2004 United Kingdom Posts 59 Re: When is a default view not a default view? Mark as Not AnswerMark as Answer... Reply Contact Please be kind enough to try something very simple for me. I feel I'm going mad! I've now tested from scratch on another PC here, and I do *not* find that Default View is taken into account from design mode!Very simple steps:1. Start IP2. "Design a form"3. "New blank form"4. You're looking at "View 1". Type "View 1" onto it.5. "Views"; "Add a new view". Name "View 2"6. You're looking at "View 2". Type "View 2" onto it.7. Select "Preview Form" (either from toolbar, or from "File" menu)What do you see? I see "View 2"! You can see from "Views" pane that "View 1" is default. You can swap which is default as much as you like; but I always get whichever one I am looking at in design mode up first. Don't you? Same on another PC.If you then save the file, I find the same whenever I reopen the file for design. If I open it for fill out, the default view *does* come up.I'd like this sorted before I tackle the "real" problem, which seems to be worse... 11-20-2004 07:28 AM In reply to jonbrave Joined on 10-15-2004 United Kingdom Posts 59 Re: When is a default view not a default view? Mark as Not AnswerMark as Answer... Reply Contact OK, after exhaustive investigation, what we seem to have here is an IP bug(?).The Question:=============When is a Default View not a Default View?The Answer:===========A Default View is not a Default View when another view has "queryView" property....The Problem:============I have an IP .XSN file. One particular view inside it --- the very fisrt view I designed originally --- is determined to be the default and come up first, no matter what I set as the actual default view. This happens whether running from Open or Design/Preview mode. (Forget anything about different behaviour on different machines.) Note that I am *not* using any script/code/rules/roles (deliberately).I can delete *everything* from all the views, all the data connections (except main), rename all the views, change the default etc. etc. and still that view comes up first. The *only* thing which works is delete the view completely and recreate it. Then all is well from then on.You/Microsoft can have the XSN if you want, but see below, 'coz I don't think it's necessary.The Reason:===========Exported the Form Files and started looking/playing (coz I'm sad, and this has been bugging me). In manifest.xsf, found this line: <xsf:property name="queryView" type="string"value="yes"></xsf:property> inside <xsf:file name="view1.xsl"> <xsf:fileProperties> ...for the offending view. Didn't find this in other XSNs which work. Deleted the "queryView" property line. From then on, all worked fine! And, I couldn't see any difference in behaviour anywhere...The Solution:=============* What is "queryView" all about? What does it do/supposed to do?* When/how/why did it get in there? (I only edited properly inside IP, SP-1.)* Am I safe to delete it to get back proper behaviour?* The only way I can delete it is via export to files & reimport; I can't seem to get at it from inside IP?* Is this a bug?I'm dying to know now, coz I've spent so long... 11-22-2004 10:53 AM In reply to Patrick Halstead Joined on 08-07-2006 Posts 5,112 Re: When is a default view not a default view? Mark as Not AnswerMark as Answer... Reply Contact quote:Originally posted by jonbraveOK, I'm starting to look into this.Can I *please* have an answer first off to a very simple question: is "Default View" taken into account when previewing from *design* mode?As you now know, it isn't. The designer opens whichever view you are on when you preview. Patrick HalsteadProject Manager at Qdabra 11-23-2004 12:21 AM In reply to jonbrave Joined on 10-15-2004 United Kingdom Posts 59 Re: When is a default view not a default view? Mark as Not AnswerMark as Answer... Reply Contact quote:Originally posted by Patrick HalsteadAs you now know, it isn't. The designer opens whichever view you are on when you preview.And as you now know from my bug report, deisgner preview does not always open whichever view you are on...Patrick/Greg, I'm reporting a bug here in the post above. I would be most appreciative if you could clarify what "queryView" property is all about and what I ought to be doing about getting rid of it. TIA. 11-23-2004 04:13 PM In reply to Greg Collins Joined on 08-07-2006 Posts 2,126 Re: When is a default view not a default view? Mark as Not AnswerMark as Answer... Reply Contact Ok, a little research -- this is, of course, actually a feature of the product.There are two key elements to make happen what you are experiencing:1. <xsf:xDocumentClass... dataFormSolution="yes" ...>2. <xsf:property name="queryView" type="string" value="yes"/>If either of these are not present you will not see the view change as you have described.Also, if you have more than one queryView property, the first one will win.Why is this the expected behavior? Because you designed your form with a data connection as your main DOM rather than an XML file. Data connection main data sources typically require a query to be useful. Therefore the form automatically loads up in the query view to allow the user to enter a query and use the form.This can be overriden by use of Open Rules or code in the OnLoad event handler. Or, you can remove the queryView property from the manifest.xsf file. This will not harm your form at all. But do not remove the dataFormSolution="yes" attribute.I hope this answers your questions to your satisfaction. If not, please reply with further details.Greg Collins [InfoPath MVP] Please Visit:BraintroveGreg's Paintings 11-24-2004 01:09 AM In reply to jonbrave Joined on 10-15-2004 United Kingdom Posts 59 Re: When is a default view not a default view? Mark as Not AnswerMark as Answer... Reply Contact Greg,Thanks for the work and explanantion. At least it all ties up with the situation I was in.Of course I'm not satisfied with the behaviour! :) I am, however, very satisfied with the support you provide :) MS not sufficiently documenting is probably what is at issue. If I set a view as a default, I expect it to be the default. If they want this behaviour when starting out from a data connection, then either document it, or disable the "Default View" property in the designer when this attribute is present. Doesn't that seem sensible?Just one last quick question: if I get rid of the queryView property line in manifest.xsf, do you know whether/when/how/if it will "reappear"? My main DOM is still a data connection, and I continue putting data connections on other views, just wondered... I guess I'm going to have to do rules/code to be quite sure anyhow... 11-24-2004 08:24 AM In reply to Greg Collins Joined on 08-07-2006 Posts 2,126 Re: When is a default view not a default view? Mark as Not AnswerMark as Answer... Reply Contact Thanx for the compliment!I ran a quick test to rebind the main DOM to the database to see if InfoPath would add the queryView property back in -- it didn't.It is my (unverified) assumption that InfoPath ONLY places this property when the form is first created. If you discover otherwise in your work, please let us know!Greg Collins [InfoPath MVP] Please Visit:BraintroveGreg's Paintings Page 1 of 1 (13 items) Copyright © 2003-2019 Qdabra Software. All rights reserved.View our Terms of Use.
quote:To answer your first question... the default view *IS* taken into account during preview from the designer.
quote:Hmmmm.... So now I technically have two problems (at least on my machine) then:1. Default View is *not* taken into account for me from design mode (as per repro steps below on brand new IP form, two views, no code, nothing...)2. On real form, reagrdless design/open mode, Default View *always* ignored and set to one particular view.Inexplicable? Related? Why do I begin to feel a "uninstall & reinstall IP" coming on? ... :-)I'm happy continuing this conversation here or at InfoPathDev.com. Probably prefer the latter. Except that it's down (again)...
<xsf:property name="queryView" type="string"value="yes"></xsf:property>
<xsf:file name="view1.xsl"> <xsf:fileProperties> ...
quote:Originally posted by jonbraveOK, I'm starting to look into this.Can I *please* have an answer first off to a very simple question: is "Default View" taken into account when previewing from *design* mode?
quote:Originally posted by Patrick HalsteadAs you now know, it isn't. The designer opens whichever view you are on when you preview.