Solved

XPath in XQuery:  Casting to xs:decimal

Posted on 2015-01-22
1
104 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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Many times as a report developer I've been asked to display normalized data such as three rows with values Jack, Joe, and Bob as a single comma-separated string such as 'Jack, Joe, Bob', and vice versa.  Here's how to do it. 
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

705 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

20 Experts available now in Live!

Get 1:1 Help Now