Updating a Secondary Data Source - InfoPath Dev
in

InfoPath Dev

Updating a Secondary Data Source

Last post 10-11-2005 11:08 AM by whapakk. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 10-09-2005 02:19 PM

    • whapakk
    • Not Ranked
    • Joined on 09-23-2005
    • Philippines
    • Posts 22

    Updating a Secondary Data Source

    I have to create an 'Order Number' which is basically just in (YYYY-XXX) format where YYYY is the current year and XXX is a number. I have to know what the last XXX was so I can increment it by 1. And if the year increments, I have to reset the XXX count to 0.

    So I thought I could use a simple xml file to store the current year and number and added it as a secondary data source. That way I can set the default value of the order number to the data from the xml file.

    Now, when the form is submitted, I want to be able to update and increment the xml file so that when the template is reused, I will get a new Order Number. Is this possible with InfoPath??

    Thanks.
  • 10-09-2005 07:05 PM In reply to

    Re: Updating a Secondary Data Source

    Hi,

    Tell us more about what you are trying to do: Are you saving your xml output locally?, Do you envision your secondary data source to be local or somewhere on a server?
    I would like to know if this is supposed to be a stand-alone application of if this is connected to a network, database, etc.

    Regards,

    Franck Dauché
  • 10-09-2005 08:32 PM In reply to

    • whapakk
    • Not Ranked
    • Joined on 09-23-2005
    • Philippines
    • Posts 22

    Re: Updating a Secondary Data Source

    Hi Franck!

    I created an infopath form that will be published to a sharepoint site and the workflow will be handled by biztalk. This form will be accessible throughout the organization through the network (sharepoint). The form itself, after processing, will have sharepoint as the final repository. For the dropdown and other lookup values, I made use of a database secondary datasource. Now, in the form, I have a field called 'Order Number'. This is supposed to be a unique number for every form. The bosses wanted to format the Order Number as YYYY-XXX where, YYYY is the current year, and XXX is a 3-digit number. ex. the first time the form will be filled out, the Order Number field should be read-only and automatically say 2005-001, the next form should be 2005-002... 2006-001..etc.
    I was thinking of a way to do this in infopath either through the formload event or through the default value formula builder for the field. So, I thought I needed a marker that tells me what the last number was, so I created a simple xml file containg just two elements, the year and the number. I then added this xml file as a secondary data source, and set the default value for the Order Number field to com from this data source.
    Now, the problem is I can't increment the initial values of the secondary xml datasource. Is there a way of doing this? Thanks.
  • 10-09-2005 10:11 PM In reply to

    Re: Updating a Secondary Data Source

    OK, I wanted to understand the entire picture because on top of what you originally described, you may have potential concurrency issues.
    If you have a database from which originate all lookup values, why don't you store 2 fields in a new table ("Number" and a "Used" column). When the IP form is opened a Web Service Call could "reserve" the next number by reading the last one in the table and incrementing by 1. At the point the "Used" column could hold the value 0.
    When the form is submitted a Web Service call would flag the "Used" Column to 1 to indicate that the number has been used. That way, you can handle concurrency. Also, you could add more logic to "release" numbers if the user closes the form without submitting, etc.

    Does it make sense?

    Regards,

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

    • whapakk
    • Not Ranked
    • Joined on 09-23-2005
    • Philippines
    • Posts 22

    Re: Updating a Secondary Data Source

    Hmmm... It does make sense but unfortunately, I'm not that familiar working with web services. I was hoping there was a direct way of modifying them either through code or rules. I guess I'll have to read up then.

    Thanks Franck!
Page 1 of 1 (5 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.