Performance Issues - InfoPath Dev
in

InfoPath Dev

Performance Issues

Last post 10-18-2005 08:12 AM by Mochi. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 10-13-2005 09:46 AM

    • Mochi
    • Not Ranked
    • Joined on 09-16-2005
    • USA
    • Posts 8

    Performance Issues

    Hi,

    I have a very basic form that retrieves data from a SQL database using the built-in data connection. It is taking about 2 minutes to render 1600 records on the form. I have read that InfoPath does not handle this well. I tried to use the paging method, which took the time down to about 35 seconds. Are there some basic things that I can do to help resolve this issue? I'm still relatively new to InfoPath and need some major help. My client is waiting for this form and I don't want to deliver a slow form. Also, does anyone know where I can find the InfoPath: Best Practices for Building Enterprise Solutions ppt that talks about Performance tips/tricks? Thanks!

    Mochi
  • 10-13-2005 10:38 AM In reply to

    Hi,

    Look at this, it should help:
    http://msdn.microsoft.com/newsgroups/default.aspx?query=InfoPath+Performance+Issue&dg=microsoft.public.infopath&cat=en-us-msdn-officedev-infopath&lang=en&cr=US&pt=6E98618B-8F9E-4724-8A45-96C336E31A25&catlist=B7714BAA-0D60-40B0-A226-8B9CF33299A5%2C774F24A2-F71F-425F-AC2B-DC48AB0DA5C9&dglist=&ptlist=&exp=&sloc=en-us

    Regards,

    Franck Dauché
  • 10-13-2005 12:01 PM In reply to

    • Mochi
    • Not Ranked
    • Joined on 09-16-2005
    • USA
    • Posts 8
    Hi,
    Thanks for the help, though I am still at a loss. I do not have any rules or conditional formatting in my form. I took out the data validation, based on the post regarding the XSF being slow. I have about 12 columns, on which 5 have onchange events. When I am querying for the data, it does hit the onchange event for each row, which might be the reason it is taking so long. In each, I have the following statement:

    If (e.Site is e.Source.ParentNode) then
    Return
    End If

    I read the following post but I'm not sure that I understand how to do this:
    "We reduced the xml event handlers to 2 global event handlers on the base DOM node, one will fire before the content is edited, and another will fire after the contents are edited."

    I don't know if this is the source of my problem. It seems like a lot of workaround for such a simple form.

    Mochi
  • 10-13-2005 04:39 PM In reply to

    Hi,

    What he means is that if you have a node (field1) in your schema, you can have an Event handler associated with it:
    [InfoPathEventHandler(MatchPath="/my:myRoot/.../my:field1", EventType=InfoPathEventType.OnAfterChange)]
    public void field1_OnAfterChange(DataDOMEvent e)
    {
    // Write code here to restore the global state.
    if (e.IsUndoRedo)
    {
    // An undo or redo operation has occurred and the DOM is read-only.
    return;
    }
    // A field change has occurred and the DOM is writable. Write code here to respond
    // to the changes.
    }

    Now, if you have handlers behind a lot of fields, the performance of your form is going down fast.
    Instead, you may have a single OnAfterChange for the entire DOM:
    [InfoPathEventHandler(MatchPath="/my:Root", EventType=InfoPathEventType.OnAfterChange)]
    public void OnAfterChange(DataDOMEvent e)
    {
    //Do something there.
    }
    In there, you want to filter for the nodes you are insterested in, and write the business logic you want.
    Basically, if you do the same for the OnBeforeChange event, you end up with "2 global event handlers".

    Now, what are you trying to achieve with the code that you posted? Whatever it is, I can tell you there is another way to do it. Please tell me more...

    Regards,

    Franck Dauché
  • 10-14-2005 10:22 AM In reply to

    • Mochi
    • Not Ranked
    • Joined on 09-16-2005
    • USA
    • Posts 8
    Hi Frank,
    Thanks so much...that makes a lot more sense to me now. I have one of my events posted below. Basically, I have 3 fields to accept the length, width, and depth for a given item. Based on these three values, I call a function to get the price category that they belong to. The code I posted in my earlier post (If Not (e.Site Is e.Source.parentNode)) was to prevent the event from firing when querying/returning data. I guess combining the events would be helpful so I wouldn't have to check if the length, width, and depth were null for each of the length, width, and depth change events. Even without any code/rules/formatting, the query for 1600 records still takes about 30 seconds. Is there anything you can think of to reduce this time?

    ' The following function handler is created by Microsoft Office InfoPath. Do not
    ' modify the type or number of arguments.
    <InfoPathEventHandler(MatchPath:="/dfs:myFields/dfs:dataFields/d:VMICrossRef/@Width", EventType:=InfoPathEventType.OnAfterChange)> _
    Public Sub VMICrossRef_Width_attr_OnAfterChange(ByVal e As DataDOMEvent)
    ' Write code here to restore the global state.

    If (e.IsUndoRedo) Then
    ' An undo or redo operation has occurred and the DOM is read-only.
    Return
    End If

    ' A field change has occurred and the DOM is writable. Write code here to respond
    ' to the changes.
    If Not (e.Site Is e.Source.parentNode) Then
    Return
    End If

    If (e.Operation = "Delete") Then
    Return
    End If
    If (e.Site.selectSingleNode("../@Length").text = "") Then
    Return
    End If
    If (e.Site.selectSingleNode("../@Width").text = "") Then
    Return
    End If
    If (e.Site.selectSingleNode("../@Depth").text = "") Then
    Return
    End If

    GetPriceCategory(e)

    End Sub
  • 10-16-2005 10:14 PM In reply to

    Hi,

    You are working with a secondary data source, right? So, why don't you add a field (field4) to your SQL Query, Web Service which is:
    field1 lenght * field2 lenght * field3 lenght
    just check if the field4 = 0.
    (In any case, Length = 0 is better than .text = "")

    Hope that it helps.

    Franck Dauché
  • 10-18-2005 08:12 AM In reply to

    • Mochi
    • Not Ranked
    • Joined on 09-16-2005
    • USA
    • Posts 8
    Thanks for the suggestion!
Page 1 of 1 (7 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.