This is my first post on this dev site and I've read a lot of helpful hints and tips, so I decided to try and get this problem resolved here... I've spent over 30 hours on this particular, seemingly easy task that my boss has been pushing me to get done for this form. Any help would be greatly appreciated because I've exhausted all resources that I can think of..
I am currently working on this Form that pulls data from a Sharepoint site. Because of this, each of the rows are filled in automatically as soon as I "preview" the form, and the table values are filled in appropriately. The problem I have is that once the data is pulled and the form is populated, I cannot calculate a "total" for each row.
In other words, I have the following fields derived from Sharepoint:
Size: /dfs:myFields/dfs:dataFields/dfs:Job_Data_List/@Size
List cost: /dfs:myFields/dfs:dataFields/dfs:Job_Data_List/@List
and I am trying to calculate, in the same row, TotalCost = @Size * @List. (/my:myFields/my:Calc/my:TotalCost) I have a footer variable that is currently calculating the total of everything, but I cannot get the calculated field on each row to calculate. Instead, it takes the value from the first row values of size and list and then extrapolates that down for the rest of the arbitrarily long list of rows.
I couldn't figure out how to do this through XPath alone, so I went to try with VBScript and my plan was to do the following:
Grab the value from Size and List fields and multiply them together to get the TotalCost for that repeating row item. I accessed the TotalCost field just fine using:
XDocument.DOM.selectSingleNode("/my:myFields/my:Calc/my:TotalCost").text
but could not do the same with the Sharepoint generated items. I'm assuming there is some kind of namespace involved that I don't know how to use? I would like to grab the "text" or "value" of its contents to be able to do my computation. After I obtained this TotalCost, I was going to try and loop through each of the rows and update the TotalCost field based off that current row's values. This would be initiated by some Button that I put at the bottom that just, upon clicking, initiated the loop and updating of the TotalCost values.
The form is basically in this kind of form:
Row 1. Field1 Field2 @Size @List TotalCost
Row 2. Field1 Field2 @Size @List TotalCost
etc.
If anyone knows the solution to this problem, or an easier solution through XPath or any other way, please let me know. I have been spending way too much time on this and this task seems so simple.
Thank you!
Mike