xdado:OriginalData and new insert into database

A

Ann Dundon

My form: I've built an InfoPath order form whose main data connection is to
a multi-table SQL Server database. The form's onload and submit
functionality are handled in VB.Net managed code.

My goal: I'd like to add a feature to the form that would let a user load an
existing order's data from the data source into a blank form, make changes
to the data, and then submit the form as a NEW order (i.e., trigger an
INSERT into the database rather than an UPDATE of the original order
record).

My problem: Though loading the existing data into the form works fine, I
haven't had any luck getting InfoPath to let me submit the modified data as
a new Insert. I guess this is because of the xdado:OriginalData that
persists in the form, even when I have programmatically updated form fields
that would otherwise cause conflicts with the Primary Key fields in my
database.

My question: Is there a programmatic way to strip the values stored as the
OriginalData from the form? Or can anyone suggest another way I could make
this feature work?
 
A

Andrew Watt [MVP - InfoPath]

My form: I've built an InfoPath order form whose main data connection is to
a multi-table SQL Server database. The form's onload and submit
functionality are handled in VB.Net managed code.

My goal: I'd like to add a feature to the form that would let a user load an
existing order's data from the data source into a blank form, make changes
to the data, and then submit the form as a NEW order (i.e., trigger an
INSERT into the database rather than an UPDATE of the original order
record).

My problem: Though loading the existing data into the form works fine, I
haven't had any luck getting InfoPath to let me submit the modified data as
a new Insert. I guess this is because of the xdado:OriginalData that
persists in the form, even when I have programmatically updated form fields
that would otherwise cause conflicts with the Primary Key fields in my
database.

My question: Is there a programmatic way to strip the values stored as the
OriginalData from the form? Or can anyone suggest another way I could make
this feature work?

Ann,

What's the purpose of allowing users to amend an existing order? I
assume it's to reuse existing data for some fields.

What about creating a view to allow a new order to be created but use
default values for certain fields? Or is the data too variable to make
that useful?

If there is a small number of "typical" orders you could perhaps use a
secondary data source and drop down. Depending on the user's choice
then, using code which makes use of the user's choice, populate
relevant parts of the order with suitable data?

Andrew Watt
MVP - InfoPath
 
A

Ann Dundon

Thanks for your reply, Andrew. To answer your questions:
What's the purpose of allowing users to amend an existing order? I
assume it's to reuse existing data for some fields.

Yes, that's correct.
What about creating a view to allow a new order to be created but use
default values for certain fields? Or is the data too variable to make
that useful?

Data is too variable. Individual users may need to prepare the same type of
order multiple times, but order data (e.g., items, vendors, accounts) will
vary widely from user to user, so there are no really "typical" orders.

I'm still interested in finding out:
a) whether there's a programmatic way to strip the values stored as the
OriginalData from a form; and
b) if doing so would let me then submit the modified form as a new order
(i.e., perform an INSERT in the db).

Can this be done?

Ann
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top