Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General MS InfoPath Questions / February 2008

Tip: Looking for answers? Try searching our database.

Programmatically Update Secondary Data Connection Sharepoint List

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
aspnerd - 14 Feb 2008 02:03 GMT
Is there a way to programmatically update a secondary data connection
record?

I can query the secondary list and retrieve the data, but I'm unable
to set the value.

I haven't been able to locate anything online which helps...

Here is what I tried...(below) and it said I couldn't update it
because it was a method group or something like that...

Can it be done?

DataSource xdsSequenceNumber = this.DataSources["Sequence Numbers"];

XPathNavigator xnSequenceNumber =
xdsSequenceNumber.CreateNavigator().SelectSingleNode("/dfs:myFields/
dfs:dataFields/dfs:Sequence_Numbers/@SequenceNumber[../@FormName =
'xxxxx']", NamespaceManager);

xnSequenceNumber.SetValue(Convert.ToString((Convert.ToInt32(xnSequenceNumber.Value)
+ 1)));
S.Y.M. Wong-A-Ton - 14 Feb 2008 05:29 GMT
Yes, you can. You are on the right track. I think you need to double-check
your XPath expression to see whether it is returning 1 node to update or a
group of nodes.
---
S.Y.M. Wong-A-Ton

> Is there a way to programmatically update a secondary data connection
> record?
[quoted text clipped - 18 lines]
> xnSequenceNumber.SetValue(Convert.ToString((Convert.ToInt32(xnSequenceNumber.Value)
> + 1)));
aspnerd - 14 Feb 2008 14:45 GMT
On Feb 14, 12:29 am, S.Y.M. Wong-A-Ton
<SYMWongA...@discussions.microsoft.com> wrote:
> Yes, you can. You are on the right track. I think you need to double-check
> your XPath expression to see whether it is returning 1 node to update or a
[quoted text clipped - 26 lines]
>
> - Show quoted text -

It should only be returning 1 node, since I'm filtering and there is
only one record for that....

I'm also doing the same thing for a field in the
maindatasource. ...the form itself...I am using this...

private int CurrentStep
       {
           get
           {
               XPathNavigator _CurrentStep =
MainDataSource.CreateNavigator().SelectSingleNode("/my:myFields/
my:CurrentStep", NamespaceManager);
               return Convert.ToInt32(_CurrentStep.Value);
           }
           set
           {
               XPathNavigator _CurrentStep =
MainDataSource.CreateNavigator().SelectSingleNode("/my:myFields/
my:CurrentStep", NamespaceManager);
               _CurrentStep.SetValue(value.ToString());
           }
       }

And that works perfectly...
S.Y.M. Wong-A-Ton - 14 Feb 2008 05:37 GMT
One more thing: Secondary data sources to SharePoint lists contain
attributes, so you might have to retrieve a node and then use its Attributes
collection to update the value of an attribute instead of using SetValue on
the node itself. There might also be a SetAttribute method that you can use.
Have a play with it; if you still cannot solve it, let me know and I'll look
deeper into the issue for you.
---
S.Y.M. Wong-A-Ton

> Is there a way to programmatically update a secondary data connection
> record?
[quoted text clipped - 18 lines]
> xnSequenceNumber.SetValue(Convert.ToString((Convert.ToInt32(xnSequenceNumber.Value)
> + 1)));
aspnerd - 14 Feb 2008 14:55 GMT
On Feb 14, 12:37 am, S.Y.M. Wong-A-Ton
<SYMWongA...@discussions.microsoft.com> wrote:
> One more thing: Secondary data sources to SharePoint lists contain
> attributes, so you might have to retrieve a node and then use its Attributes
[quoted text clipped - 29 lines]
>
> - Show quoted text -

ok CORRECTION ....the code 'works'...sort of... it changes the value
in the page...but in the secondary list (it's a retrieve data
connection) it doesn't actually save the change to the data list. It
only changes it in that page for the time being....

so how can I save it to the data list in sharepoint so that it sticks?
S.Y.M. Wong-A-Ton - 14 Feb 2008 22:44 GMT
Yes, you can change the data in the sec DS, but that will not do anything in
your SharePoint list. An MSDN article has just been published on submitting
data to a SharePoint list; see
http://msdn2.microsoft.com/en-us/library/cc162745.aspx
---
S.Y.M. Wong-A-Ton

> On Feb 14, 12:37 am, S.Y.M. Wong-A-Ton
> <SYMWongA...@discussions.microsoft.com> wrote:
[quoted text clipped - 38 lines]
>
> so how can I save it to the data list in sharepoint so that it sticks?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.