Sec Data Source , propagation && anti-propagation - InfoPath Dev
in

InfoPath Dev

Sec Data Source , propagation && anti-propagation

Last post 09-14-2005 11:04 PM by Patrick Halstead. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 09-07-2005 09:07 AM

    Sec Data Source , propagation && anti-propagation

    Ok, here is my dilemma:

    I am making a proposal form for the sales department using InfoPath and this form draws in all of the prices from a secondary data source that is linked to PriceListMasterCurrent.xml (which is stored on a shared network drive, so it is not included as a resource file) for all of the data pertaining to unitPrices, shipping costs, overhead, etc. Let's say this PriceListMasterCurrent.xml changes every 2 weeks (worst case scenario).

    This is what I need to happen when filling out the proposal form:

    1) Sales opens a new form on 09/07/05 and chooses items from the pre-populated (from "PriceListMasterCurrent.xml") drop-downs what items and service aggreements are to be on the proposal. Everything is automatically calculated and works fine.

    2) Sales saves this form as "Client1_09_07_05.xml", prints it up and sends it to the client for review.

    3) Sales goes about their business, and then the PriceListMasterCurrent changes on 09/10/05.

    4) Sales opens a new proposal form on 09/12/05 and works out a new proposal with the price list changes effective from 09/10/05 and saves it as "Client2_09_12_05.xml".

    5) Client 1 calls Sales and asks if they might make a few revisions to their proposal on 09/13/05.

    =========== This is where it starts falling apart =============

    6) Sales opens "Client1_09_07_05.xml", which needs to use the price list revision prior to the one made on 09/10/05. Sales makes the changes and saves again as "Client1_09_07_05.xml".

    ====================================================================================
    ====================================================================================

    Basically when Sales opens a new proposal form to fill out, when they save the form as an .xml it needs to use the same PriceList that it was created with. However, new forms still need to dynamically link to the PriceListMasterCurrent.xml to keep up with current revisions.

    Here is the solution that is a pretty sure fire way to do it (imo):
    *Make 2 secondary data sources based off of PriceListMasterCurrent.xml within Proposal.xsn: 1)PriceListMasterCurrentExternal, 2)PriceListMasterCurrentInternal
    *PriceListMasterCurrentExternal is dynamically linked to a file on the network
    *PriceListMasterCurrentInternal is included as a resource file within Proposal.xsn
    *Using DOM commands and extensive scripting, copy the contents of PriceListMasterCurrentExternal into PriceListMasterCurrentInternal on the .xsn's OnLoad() function.
    *Populate new Proposal forms with the data from PriceListMasterCurrentInternal.

    Other solutions I have looked into:
    // i get the error "This object does not support this method" when I try this. I think I have to import
    // schema and .xsl for the PriceList files to enable it, but that seems like a really long process,
    // especially if the price list changes every 2 weeks
    XDocument.DataObjects("PriceListMasterCurrentInternal").ImportFile("\\192.168.100.116\Programs\LIBRARY\FORMS\data\PriceListMasterCurrent.xml");



    So, does anyone have any ideas? I would think there has to be a simpler way to do this than hard-coding a "copy()" function into my Proposal form.

    ---------------
    Matt Faus
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 09-09-2005 06:49 AM In reply to

    Re: Sec Data Source , propagation && anti-propagation

    Is this a dumb question or can no one help me? Is it clear what I'm asking?

    ---------------
    Matt Faus
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 09-10-2005 10:02 PM In reply to

    Re: Sec Data Source , propagation && anti-propagation

    Hi Matt,

    Sorry for the delay. I saw your post yesterday but didn't have time to read it until today. Anyway, using ImportFile (or Import) isn't that hard and is a good way to get the Price List data into your main DOM which is what you need to do to make sure it persists with the XML file. The cool thing about ImportFile is you won't need a lot of code. The nasty thing about ImportFile is debugging the XSL but it's a very powerful technique.

    Another option is to use rules to copy the values from the Price List into your main DOM. May not be performance and may require a lot of rules.

    I think the easiest way is the first one you mention. This really should take that much code. We do stuff like this all the time. My guess is it's ~20 lines of code. It's not extensive. If you'd like an example, I'll dig one up.

    Cheers

    Patrick Halstead [InfoPath MVP]
    InfoPathDev
    Patrick Halstead
    Project Manager at Qdabra
  • 09-12-2005 07:58 AM In reply to

    Re: Sec Data Source , propagation && anti-propagation

    XDocument.DataObjects("PriceListMasterCurrentInternal").ImportFile("\\192.168.100.116\Programs\LIBRARY\FORMS\data\PriceListMasterCurrent.xml");

    I'm trying this code, which should merge the form data found at \\192.168.100.116\Programs\LIBRARY\FORMS\data\PriceListMasterCurrent.xml with my secondary data source. I have tried several different things and have gone through the MSDN tutorial found at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ipsdk/html/ipsdkCustomFormMerging_HV01083844.asp), but I keep getting this error:

    Object doesn't support this property or method

    on the line that I've got the ImportFile() method.

    ---------------
    Matt Faus
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 09-13-2005 01:38 AM In reply to

    Re: Sec Data Source , propagation && anti-propagation

    Hi Matt,
    Import only works on the Main DOM. Which is what you want, anyway, since you have to persist the data.

    Patrick Halstead [InfoPath MVP]
    InfoPathDev
    Patrick Halstead
    Project Manager at Qdabra
  • 09-13-2005 12:45 PM In reply to

    Re: Sec Data Source , propagation && anti-propagation

    Ah, I think I get you now. Although I have already figured out a work-around and I think I'm going to stick with it. (Makes more sense in my head and with the form/data structure I have laid out).

    Folder structure:

    /
    Proposal.lnk

    /dev/
    Proposal_v09_10_05.xsn
    Proposal_v09_01_05.xsn

    /dev/data/
    PriceList_09_10_05.xml
    PriceList_09_01_05.xml


    *When Sales opens a new Proposal template on 9/2/05 by clicking on "Proposal.lnk" it populates price fields with prices from the PriceList_09_01_05.xml b/c "Proposal.lnk" points to "Proposal_v09_01_05.xsn". When they save this "Client1_09_02_05.xml" wherever they want it still points to "Proposal_v09_01_05.xsn" for the price list no matter when they open it again.


    Also, now that I'm thinking about it, if I imported the new XML into the same form template every time, then when Sales opens Client1's proposal a couple weeks down the road after the prices have changed it will have the NEW prices embedded in it, while I need the price that the proposal was CREATED with.

    From what I know about InfoPath and what I'm trying to accomplish, I think this is the only way to do it, since I need propagation on NEW proposals but NOT on old proposals - see what I'm saying?

    Anyway, thanks for the help, everything has worked out finally.


    ---------------
    Matt Faus
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 09-14-2005 11:04 PM In reply to

    Re: Sec Data Source , propagation && anti-propagation

    Hi Matt,

    OK, that works! Glad you found a workaround but it will require multiple XSNs. The main benefit of the XSL import approach is to be able to just use one XSN. What happens down the road if you have to change the XSN? Maybe you don't want to change it for past forms... come to think of it that's exactly your scenario... ok, sorry!

    Carry on! Hopefully, I'll be more useful next time ... :)

    Patrick Halstead [InfoPath MVP]
    InfoPathDev
    Patrick Halstead
    Project Manager at Qdabra
Page 1 of 1 (7 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.