Solved

Infopath Changing data before submiting to SQL

Posted on 2010-08-26
10
304 Views
Last Modified: 2012-05-10
I have a form that submits data to  MS sql database.
The form has a repeating table with several fields.
This was working fine until I added a secondary data source to the same sql table.
This was to query some of the data fields.
Now when I submit the data to the main connection the data in my repeating table changers before it is put in the database
So I have two fields in my form that are start time and finish time
If I put 8:00 in my start time and 9:00 in my finish time then submit the data
I get the same data in my database.
But if I add another row to my repeating table with a start time of 10:00 and a finish time of 11:00
Then submit
The new row has a start time of 8:00 and a finish time of 9:00 the same as the first entry.
The data in the sql database is the same.
But if I clear the form before adding the new data this the data is correct.  
The form was working until I added a secondary connection to the database  
Any ideas as this is driving me mad
0
Comment
Question by:LeePrice
  • 5
  • 4
10 Comments
 
LVL 15

Expert Comment

by:melli111
ID: 33533746
Check you text box in the repeating table for the start time and end time - do you have any default values?  OR do you have any rules that update these fields?  You can use the logic inspector and look through to see if anything else updates those particular fields.    (Tools > Logic Inspector...)
0
 

Author Comment

by:LeePrice
ID: 33533855
i have checked and nothing is being set.
i wasn't clear before in my question.
This is hapening with all the fields in the repeating table.
i just used the start time and finish times as an example
thanks for the prompt reply
0
 
LVL 15

Expert Comment

by:melli111
ID: 33533994
I'm working on re-producing this error.  What do you use the secondary datasource for?  i.e. what are you pulling in from it and are you storing any values from it in the new data?
0
 

Author Comment

by:LeePrice
ID: 33534182
i was using the secondry data source to pull the total meters cut for the past 7.
the sql query that i was using is

select Distinct("TotalMetersCut"),"FaceDate" from "dbo"."Face" as "Face" Where "FaceDate" > getdate()-7

just so you know im using infopath 2010 and ms sql 2005 on a windows 7 pc
i hope this helps.
0
 
LVL 15

Expert Comment

by:melli111
ID: 33534303
I haven't used infopath 2010 yet so hopefully there's no difference between versions that may be causing this.  would you mind sharing your form?  You can attach it to this post if you save a copy of it as a .txt; then I'll download it, save it and change it back to .xsn.  If you don't want to that's ok, it's just a little easier to diagnose looking at it
0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:LeePrice
ID: 33534718
attached is the form saved as txt.

FaceReportV07.txt
0
 
LVL 15

Expert Comment

by:melli111
ID: 33534971
OK, I think I got it - it's hard for me to tell for sure since I can't test it (submit) since I obviously don't have the same database tables.  
At the header of your form you have the date, shift, and the face.  These are bound to the query fields in your main connection.  These query fields pull the information from the database to display in the data fields.  When you submit that first line of data is going into the database and those query fields see it in the query, setting the remaining datafields' values in the repeating table to the first line.  
Action:  Change the header fields at the top of your form either to the datafields (not query)  from your main connection or you can create fields for them in your HelperFields.
0
 

Author Comment

by:LeePrice
ID: 33535340
thank you for the reply. I have just tried your sugestion. I have remoed the header fields but I'm still getting the same problems. can you see nything else?
0
 
LVL 28

Accepted Solution

by:
clayfox earned 250 total points
ID: 33535398
I have had this issue.

The data looks great in InfoPath right before submit.

Submit to SQL and the last record is repeated instead of the new record.

I think it is a bug.  The only way I have fixed it is to back track to my previous version before the last change and do it again.

I think something corrupts sometimes to cause this.

Hopefully you have a saved version from before the modification you made.

Save often and test often to make sure it has not broken. I have not had it happen twice but I have had it occur on a couple different forms and with both 2005 and 2008 databases and in InfoPath 2010 and 2007.
0
 

Author Comment

by:LeePrice
ID: 33540399
thats exactly the problem.

well thank you both for your help.
its not quite the answer i was looking for but at least i know i wasn't doing something worng.
Clayfox im going to take your advice and save and test more frequently!
thank you both.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

If you having speed problem in loading SQL Server Management Studio, try to uncheck these options in your internet browser (IE -> Internet Options / Advanced / Security):    . Check for publisher's certificate revocation    . Check for server ce…
In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
This video discusses moving either the default database or any database to a new volume.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now