How to sum two XPATH Values - xpath-1.0

I need to sum the values of the following two XPATHS
1: /data/dealerLoanApplication[1]/licenseFee[1]
2: /data/dealerLoanApplication[1]/titleFees[1]
When I test the above XPATHs separate I get the correct amounts.
for
/data/dealerLoanApplication[1]/licenseFee[1] I get back 50
for /data/dealerLoanApplication[1]/titleFees[1] I get back 100.
I am trying to sum(/data/dealerLoanApplication[1]/licenseFee[1]//data/dealerLoanApplication[1]/titleFees[1])
I expect to get back 150.00 but I am getting back 0.00

Related

Time difference With 0 Values

Im having a problem in google sheets. I want to sum 2 columns the time that a driver is driving without the stops. So im using this formula to do it:
G7 is 10:20 value and H6 is 10:00.
But I want to do it in all the lines, but when I use the same formula:
I get this value:
Any idea how can I ignore the zero values that are making my database giving me wrong values when in this example the result I want is 00:40. The time driving without the unloads?
use:
=TEXT(SUMPRODUCT(IF(G7:G20="";;G7:G20-H6:H19)); "[h]:mm")

Sum multiple values returned vertically from vlookup

I have the following table which I need to have all the values found from multiple ranges vertically.
I was using the following formula, but I'm only getting 1 result and not 7. After getting all those 7 values, I need to add them together in order to get a total.
So far my guess was to try the 2nd formula but obviously is not returning what I need but maybe is something around those corners.
=SUM(ARRAYFORMULA(VLOOKUP(E4,{range0,range1,range2,range3,range4,range5,range6},5,false)))
=SUM(ARRAYFORMULA(VLOOKUP(E4,{range0,range1,range2,range3,range4,range5,range6},{5,5,5,5,5,5,5},false)))
You can use FILTER instead:
Formula:
=SUM(INDEX(FILTER(B6:F, B6:B = "name1"),,5))
Use FILTER to get the rows of B6:F where "name1" is found in B6:B
Use INDEX to get only the specific column which is in our case, 5
Then SUM the column.

Calculate Total row Averages correctly if table columns contain empty cells

I am using the following formula to calculate a Total row that calculates averages for percentages in the columns. However, since the data contains some empty values, the averages calculated is not correct.
={"TOTAL",arrayformula(transpose(query(transpose(query({(B16:M19)},"Select " & TEXTJOIN(",",true,arrayformula(if(filter($B$15:15,$B$15:15<>false),"Sum(Col" & Column($B$15:$M$15) - Column(B$15) + 1 & ")/Count(Col" & Column($B$15:$M$15) - Column(B$15) + 1 & ")"))))),"select Col2 format Col2 '0.00%'",)*100%))}
Ocassionally, I also get errors in my production spreadsheet viz.,
Unable to parse query string for Function QUERY parameter 2: AVG_SUM_ONLY_NUMERIC
or
Unable to parse query string for Function QUERY parameter 2: TypeError: Cannot read property 'get' of undefined
These go away if i coerce the range like this:
(B16:M19)+0 .... or.... N(B16:M19)
But this results in the average calculated incorrectly as the average considers the 0's that get replaced or the empty cells now. How can this be avoided and the values calculated correctly?
P.S: i had to hardcode the range as i don't know how to make this formula more dynamic. If anyone has an idea, please do share with me.
Here is the sample sheet. FTR Table
I came up with this formula, for your total values. See B23 in your Tables sheet:
=IFERROR(SUM(B16:B19)/COUNT(FILTER(B16:B19,B16:B19>0)),0)
If this tests out okay for you, I can try to see if it can be developed as an arrayformula.
It just sums each column in the table, and divides that by the count of values in the table that are greater than zero, so it excludes both blanks and zeroes in the table.

What is the nPrecision parameter of RobotC displayLCDNumber?

Vex ROBOTC has the following command for displaying integers to the LCD display:
displayLCDNumber(nLine, nPos, nValue, nPrecision);
I'm trying to display the following: displayLCDNumber(0, 4, (float) 3.14159, nPrecision);
Supposedly, using the nPrecision parameter I should be able to display floats. Unfortunately, I cannot seem to get this to work. When I specify a negative integer, it just adds leading 0s to the displayed numbers. When I specify positive, it just shifts the integer portion of my number that many places right. When I try decimal nPrecisons such as 0.6, it does nothing. What is the nPrecision parameter and what do I need to set it too to correctly display my number?
API here: http://www.robotc.net/wikiarchive/VEX2_Functions_Display
Edit:
Any help would be apreciated, preferably as soon as possible because I will only get a chance to test/use it tomorrow and friday for like 30 minutes.

Loop through fields in rdlc report

I have an Rdlc report
In this report I have a field which takes its values by this expression
(Round(((First(Fields!Occurs.Value) / First(Fields!TotalDistance.Value))* 10000),2)
but in some cases (TotalDistance.Value) = 0 so the previous expression returns Infinity,
So I need to get the next record in case of that field equals 0 ,
If also next field equals 0 , I want to get the next one
I looked for way of getting next record but didn't find
I only found (First , Last) methods,
How can I do that ?
instead of using First or Last if you don't care which record as long as it isn't 0 then couldn't you use an aggregate function. ex:
(Round(((First(Fields!Occurs.Value) / MAX(Fields!TotalDistance.Value))* 10000),2)
you could use Max, Min or Avg to get a value. I am unaware of any way within the rdlc to loop through the records like you are asking.
Another completely different way could be to load the data into a datatable then add a column to contain the calculated value and use some code to calculate the values before being passed to the report.

Resources