Solved

XPath in XQuery:  Casting to xs:decimal

Posted on 2015-01-22
1
105 Views
Last Modified: 2015-01-26
This works well for me

fn:sum($asset/(in:currentprice * in:quantity))

Open in new window


But I have tried to convert this to an xs:decimal as follows, but they do not work:

fn:sum($asset/(in:currentprice * in:quantity))/xs:decimal()

fn:sum($asset/(in:currentprice * in:quantity)/xs:decimal())

Open in new window


How can I cast the following XPath statement to xs:decimal ?

fn:sum($asset/(in:currentprice * in:quantity))

Open in new window


Thanks
0
Comment
Question by:Anthony Lucia
1 Comment
 
LVL 60

Accepted Solution

by:
Geert Bormans earned 500 total points
ID: 40565939
If the casting to decimal is a precision issue,
you need to cast prior to the calculation in order to obtain correct results

fn:sum($asset/(in:currentprice/xs:decimal() * in:quantity/xs:decimal()))

I
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

930 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

8 Experts available now in Live!

Get 1:1 Help Now