Here is what i am trying to do.
I have a WSS list with 2 columns Year and ProjectNumber. This is being used to create an incrementale number with the addition that the numbers start from 1 again at the begining of a new year.
I have created a data source that points to this WSS list. I have then created a field that looks at this list and selects the MAX project number for the current year. Here is the code in from infopath
max(@ProjectNumber[@Year = substring(now(), 0, 5)])
This works great.
What i would like to do is execute this data connection in code (easy) and then select the max value so that i can use it to create by reference number.
I have tried the following but am now completely stuck.
XPathNavigator xpn = this.DataSources["MasterProjectNumbers"].CreateNavigator();
string xpath = @"xdMath:Max(xdXDocument:GetDOM('MasterProjectNumbers')/dfs:myFields/dfs:dataFields/dfs:MasterProjectNumbers/@ProjectNumber[../@Year = substring(xdDate:Now(), 0, 5)])";XmlNamespaceManager nsmgr = new XmlNamespaceManager(this.CreateNavigator().NameTable);
nsmgr.AddNamespace(
"xsl", "http://www.w3.org/1999/XSL/Transform");nsmgr.AddNamespace("dfs", "dfs.xsd");
MasterProjectNumber = xpn.SelectSingleNode(xpath, nsmgr).Value;
MasterProjectNumber is a property that relates to a field i have on my form.
Does any one have an idea how i can execute this type of query in c#. At the moment i have a field on my form that i will hide to do the filtering but i would rather do all of it inthe background.
Buzz