XPATH sum(node-set) function using PLSQL
Hi,
I'm using the XMLDOM and XSLPROCESSOR PLSQL packages to parse my XML and need to sum a Node element. I was wondering how can I achieve the following XSL command within PLSQL ??
<xsl:value-of select="sum(<some nodeset>)"/>
Can I use the XSLPROCESSOR.valueOf function to get the sum ?? Or is there another way ??
Regards,
Mark
Can you try this?
Similar Messages
-
Hi,
I want to get all the elements in a sequence from my xml input. I do this. (FechasPago is the root node, and fechaPago represent the elements in the sequence)
1- get the number of elements in the sequence.
last(bpws:getVariableData('inputVariable',
'payload','/ns1:Solicitud/ns1:FechasPago
/ns1:fechaPago'))
2- use a while and an i variable to go throw the sequence.
while condition: bpws:getVariableData('n_pagos') = bpws:getVariableData ('i')
3- then I use current to get the current element.
current(bpws:getVariableData('inputVariable','payload','/ns1:Solicitud/ns1:FechasPago'))
4-increment i
bpws:getVariableData('i') + 1
please tell what i´m doing wrong.
source bpel code:
<while name="While_1" condition="bpws:getVariableData('n_pagos') = bpws:getVariableData
('i')">
<sequence name="Sequence_4">
<wait name="eperar_fecha_pago" for="current(bpws:getVariableData('inputVariable','payload','/ns1:Solicitud/ns1:FechasPago'))"/>
<assign name="sum_i_1">
<copy>
<from expression="bpws:getVariableData('i') + 1"/>
<to variable="i"/>
</copy>
</assign>
</sequence>?
-
Hi,
I want to get all the elements in a sequence from my xml input. I do this. (FechasPago is the root node, and fechaPago represent the elements in the sequence)
1- get the number of elements in the sequence.
last(bpws:getVariableData('inputVariable',
'payload','/ns1:Solicitud/ns1:FechasPago
/ns1:fechaPago'))
2- use a while and an i variable to go throw the sequence.
while condition: bpws:getVariableData('n_pagos') = bpws:getVariableData ('i')
3- then I use current to get the current element.
current(bpws:getVariableData('inputVariable','payload','/ns1:Solicitud/ns1:FechasPago'))
4-increment i
bpws:getVariableData('i') + 1
please tell what i´m doing wrong.
source bpel code:
<while name="While_1" condition="bpws:getVariableData('n_pagos') = bpws:getVariableData
('i')">
<sequence name="Sequence_4">
<wait name="eperar_fecha_pago" for="current(bpws:getVariableData('inputVariable','payload','/ns1:Solicitud/ns1:FechasPago'))"/>
<assign name="sum_i_1">
<copy>
<from expression="bpws:getVariableData('i') + 1"/>
<to variable="i"/>
</copy>
</assign>
</sequence>
</while>I guess your condition for the while loop is wrong. You may need to change it to,
<while name="While_1" condition="bpws:getVariableData('n_pagos') > bpws:getVariableData
('i')">. Pl confirm.
Ramesh -
Implementing maker-checker functionality using PLSQL
Hi,
I would like to know if someone has implemented maker-checker functionality. If so then please let me know the tables/views to be created. PLSQL code to implement the logic. If you have any design document then please share.
Looking forward for your help.user10566312 wrote:
Hi,
I would like to know if someone has implemented maker-checker functionality. If so then please let me know the tables/views to be created. PLSQL code to implement the logic. I'm not going to do your work. But I'd like to share an Idea:
The table containig the objects needing double-check would get a mandatory Creat_user attribut filled with the (front end) user name drawn from the v$session.
Then I'd create a "Check" table with Object_id and check_user as the only attributes. The check_user
attribut would also be filled with user name found in v$session.
I'd have a Trigger on the "Check" table making sure that the user inserting the "Check" entry is not the same as the one that created the Object.
Of cause I'd prevent inserting or updating the user attributes with custom values.
bye
TPD -
Document(object, node-set)
Using xsql 1.0.4.1, I'm having some trouble using the document(object, node-set) function defined in the XSLT 1.0 recommendation, sect 12.1:
http://www.w3.org/TR/xslt#function-document
I have a tag in my source xml document which contains a reference to another xml document. I want to construct an XPath expression for this other xml document. The path to the other xml document is specified relative to the source document.
I'm doing something like this:
Source Document:
<blah>
<some-tag redirect="answer.xml" />
</blah>XSL:
<xsl:template match="blah/some-tag">
<xsl:variable name="redir" select="document(@redirect, / )" />
<xsl:apply-templates select="$redir//somepath" />
</xsl:template>
...However, Oracle XSLT always comes back with the following error:
XSL-1013: Error in expression 'document(@redirect, / )'.I also get this error if I try
document(@redirect, document(''))which is given as an example on pg 446 of Steve's book (but not what I want, since it resolves relative to the stylesheet).
document(@redirect)works fine, but again is not what I want.
Am I doing something wrong?
BrianThis is Oracle Bug# 1722555, hopefully which will be fixed in the 9.0.1.0.0 release. Currently the two-argument version of the document() function is not recognized properly.
-
Xml result fragment to node-set
I wrote a stylesheet that transforms data into a html table and dedupes all consecutive identical elements.
The consecutive duplicates obviously depend on the sorting of the data, which is also a variable of the stylesheet.
I ended up using the msxml:node-set function that allowed me to convert a sorted result fragment (in a variable) back into a node-set. Is there anything equivalent in oracle's parser? or a workarround to pre-sort the data?
I would like to avoid multi-step transforms if possible...
thanks for any help.
nullnever mind... found ora:node-set()
must have been blind I guess....
null -
Casting a result-tree-fragment into a node set
Hi,
Is there anything in BI Publisher that converts a result-tree-fragment into a node set, which resembles the node-set function in as in the following link? http://www.exslt.org/exsl/functions/node-set/
Thanks,
JonathanHi,
Seems no one understands my need in my post yet. Let me elaborate my requirement a little more...
Actually in my case, I used a variable to refer to a node set (in my actual implementation the conditions in the bracket [] are much much more complicated ), e.g.
<?variable:rows;”/ROWSET/ROW[SALARY>1000]”?>
And since the report involves a complex layout printed on pre-print forms which needs me to put the fields very precisely. I cannot use the For Each method but to extract the rows one by one, likes the following:
<?$rows[1]/ENAME?>
<?$rows[2]/ENAME?>
and put them on various position on the RTF Template.
So far so good, until I realized that the $rows node set is needed to be sorted according to ENAME.
Currently I can build a sorted list from $rows into another variable $sorted_rows as follows:
<xsl:variable name="sorted_rows"><xsl:for-each select="$rows"><xsl:sort select="ENAME"/><xsl:copy-of select="."/></xsl:for-each></xsl:variable>
But in $sorted_rows, it contains only one item which is the xml fragment of the sorted data, but not a node set.
So my question is, is there any way to convert this xml fragment into a node set so I can use the following to extract the fields?
<?$sorted_rows[1]/ENAME?>
<?$sorted_rows[2]/ENAME?>
Hope anyone can share with my some solution to this.
Thanks in advance,
Jonathan -
Using msxsl:node-set as a function to a field in InfoPath 2010
I have been trying to query a node set (from a web service - managed metadata web service infact) without success. I received a GetTermSetsResult that I am trying to parse as an xml using msxsl:node-set(). Currently I am just throwing
up messages about the expression result in a form load rule. I just get empty node sets. Note that I have even tried querying the xml string directly like in the examples below but the behavior is always the same.
some examples of what I have tried that give empty nodesets:
msxsl:node-set('<Container><TermStore>...'))/Container/TermStore
msxsl:node-set('<Container><TermStore>...'))/Container
msxsl:node-set('<Container><TermStore>...'))/*
These give the following results:
count(msxsl:node-set('<Container><TermStore>...'))) ---> reports "1"
count(msxsl:node-set('<test>...</test><test>...</test>'))) ---> reports "1" when it should say "2"
msxsl:node-set('<Container><TermStore>...'))/node() ---> returns what looks like the entire xml document
Ultimately I want to populate a listbox with managed metadata (taxonomy/folksonomy) terms in a "codeless" way. I know it is a no brainer to use code behind but where I work they like to see minimum code.Hello mohrr,
The PCIe-6321 doesn't have internal triggers you you have to export the signals to a PFI line ant the use the signal as external trigger.
If you are not very familiar about how to do that, here you can find two documents that can give you an idea about how does it work.
http://digital.ni.com/public.nsf/allkb/A099C37789AACEE386256E35007338E6?OpenDocument
http://digital.ni.com/public.nsf/allkb/3A7F1402B2A1CE7686256E93007E66C0?OpenDocument
Mr.O
Applications Engineer
National Instruments -
How to use the set functions effectively in webi ,please let me know with detail
how to use the set functions effectively in webi ,please let me know with detail
Hi,
we use use set functions on heirarchies with aggregate functions mostly .
If you include member_set, Min returns the minimum value of the aggregated data for all members in the member set.
Member_set can include multiple sets separated by semicolons (;).
The list of member sets must be enclosed in {}.
If the member set expression does not specify a precise member or node, the hierarchy referenced must be present in the table, then the member set expression references the current member in the hierarchy in the table. If the hierarchy is not in the table, the function returns the message #MULTIVALUE.
Eg .
1) Ancestor
=Sum([YTD] ; {Ancestor([Test Hierarchy];2)})
2) IsLeaf
=[Test Hierarchy].IsLeaf
You can use this function when you want to show your Measure only at lower level .
3) .Depth
=[Test Hierarchy].Depth
This is also function used with hierarchy to find Level of Members .
Follow this link for PDF reference .
Page 147
https://www.google.co.in/url?sa=t&rct=j&q=&esrc=s&source=web&cd=2&cad=rja&ved=0CDIQFjAB&url=https%3A%2F%2Fhelp.sap.com%2Fbusinessobject%2Fproduct_guides%2Fboexir4%2Fen%2Fxi4sp5_ffc_en.pdf&ei=nBAUU-iUM4WWrAeMuoCoDg&usg=AFQjCNHakXsEjd_yUk2y3lVdibf3PXpEOA&bvm=bv.61965928,d.bmk
search on SCN this question was discussed before also one those links .
http://scn.sap.com/thread/3183380
Hope this will help you . -
I have pdf files in European languages and want to be able to enter non-English characters in the "find" function. How does one install other character sets for use with Acrobat Pro XI?
Have you tried applying the update by going to Help>Updates within Photoshop Lightroom? The update should be using the same licensing? Did you perhaps customize the installation location? Finally which operating system are you using?
-
How to extract node value by using xpath in orchestration shape
i want extract the node value by using xpath in expression shape in orch, then assign to variable.
then decide shape in if branch im using check condition based nodevalue .
str = xpath(Message_3, ("string(/*[local-name()='Root' and namespace-uri()='http://BizTalk_Server_ProjectRNd2.Schema3']/*[local-name()='no' and namespace-uri()=''])"));
but i got below error:
xlang/s engine event log entry: Uncaught exception (see the 'inner exception' below) has suspended an instance of service 'BizTalk_Server_ProjectRNd2.BizTalk_Orchestration1(f3c581d3-049f-8a8a-9316-fc1235b03f99)'.
The service instance will remain suspended until administratively resumed or terminated.
If resumed the instance will continue from its last persisted state and may re-throw the same unexpected exception.
InstanceId: 020779be-713d-408c-9ff4-fd1462c2e52c
Shape name: Expression_1
ShapeId: b865a3e1-7ebe-410d-9f60-8ad2139ad234
Exception thrown from: segment 1, progress 10
Inner exception: There is an error in the XML document.
Exception type: InvalidOperationException
Source: System.Xml
Target Site: System.Object Deserialize(System.Xml.XmlReader, System.String, System.Xml.Serialization.XmlDeserializationEvents)
The following is a stack trace that identifies the location where the exception occured
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
at Microsoft.XLANGs.Core.Part.XPathLoad(Part sourcePart, String xpath, Type dstType)
at BizTalk_Server_ProjectRNd2.BizTalk_Orchestration1.segment1(StopConditions stopOn)
at Microsoft.XLANGs.Core.SegmentScheduler.RunASegment(Segment s, StopConditions stopCond, Exception& exp)
Additional error information:
<no xmlns=''> was not expected.
Exception type: InvalidOperationException
Source: System.Xml
Target Site: System.Object Read_string()
The following is a stack trace that identifies the location where the exception occured
at System.Xml.Serialization.XmlSerializationPrimitiveReader.Read_string()
at System.Xml.Serialization.XmlSerializer.DeserializePrimitive(XmlReader xmlReader, XmlDeserializationEvents events)
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)Hi,
as per your code i got below error
Uncaught exception (see the 'inner exception' below) has suspended an instance of service 'BizTalk_Server_ProjectRNd2.BizTalk_Orchestration1(f3c581d3-049f-8a8a-9316-fc1235b03f99)'.
The service instance will remain suspended until administratively resumed or terminated.
If resumed the instance will continue from its last persisted state and may re-throw the same unexpected exception.
InstanceId: f5fffb05-e6d6-4765-83da-4e6c9696dd8a
Shape name: Expression_1
ShapeId: b865a3e1-7ebe-410d-9f60-8ad2139ad234
Exception thrown from: segment 1, progress 10
Inner exception: There is an error in the XML document.
Exception type: InvalidOperationException
Source: System.Xml
Target Site: System.Object Deserialize(System.Xml.XmlReader, System.String, System.Xml.Serialization.XmlDeserializationEvents)
The following is a stack trace that identifies the location where the exception occured
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializat
this is my schema:
<?xml version="1.0" encoding="utf-16"
?>
<xs:schema xmlns="http://BizTalk_Server_ProjectRNd2.Schema3" xmlns:b="http://schemas.microsoft.com/BizTalk/2003"
xmlns:ns0="https://BizTalk_Server_ProjectRNd2.PropertySchema" targetNamespace="http://BizTalk_Server_ProjectRNd2.Schema3" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:annotation>
<xs:appinfo>
<b:imports>
<b:namespace
prefix="ns0" uri="https://BizTalk_Server_ProjectRNd2.PropertySchema" location=".\PropertySchema.xsd"
/>
</b:imports>
</xs:appinfo>
</xs:annotation>
<xs:element name="Root">
<xs:annotation>
<xs:appinfo>
<b:properties>
<b:property
name="ns0:no" xpath="/*[local-name()='Root' and namespace-uri()='http://BizTalk_Server_ProjectRNd2.Schema3']/*[local-name()='no' and namespace-uri()='']"
/>
</b:properties>
</xs:appinfo>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element
name="no" type="xs:string" />
<xs:element
name="name" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema> -
How to use union statement with declare & set function?
Hi Experts,
i have small query about how to use union statement with declare & set function?
Example as below :
DECLARE @name AS date
Declare @name2 AS date
/* SELECT FROM [2013].[dbo].[OINV] T0 */
/* WHERE */
SET @name = /* T0.DocDate */ '[%1]'
SET @name2 = /* T0.DocDate */ '[%2]'
select '2013',t5.U_salmannm,t1.CardName,t2.sumapplied as CollectionAmount,t2.DcntSum ,t3.DocTotal as InvoiceTotal,
datediff(dd,t3.DocDate,t1.Docdate) as Days
from 2013.dbo.orct t1
inner join 2013.dbo.RCT2 t2 on t1.DocNum = t2.DocNum
left join 2013.dbo.oinv t3 on
t3.docentry = t2.baseAbs
inner join 2013.dbo.ocrd t4 on t1.Cardcode = t4.CardCode
inner join [2013].[dbo].[@CQ_RTSM] t5 on t4.U_BeatCode = t5.U_RoutCode
where t2.DcntSum <> 0.000000 and t3.DocDate between [%1] and [%2]
Union
/* SELECT FROM [2014].[dbo].[OINV] T0 */
/* WHERE */
SET @name = /* T0.DocDate */ '[%1]'
SET @name2 = /* T0.DocDate */ '[%2]'
select '2014',t5.U_salmannm,t1.CardName,t2.sumapplied as CollectionAmount,t2.DcntSum ,t3.DocTotal as InvoiceTotal,
datediff(dd,t3.DocDate,t1.Docdate) as Days
from 2014.dbo.orct t1
inner join 2014.dbo.RCT2 t2 on t1.DocNum = t2.DocNum
left join 2014.dbo.oinv t3 on
t3.docentry = t2.baseAbs
inner join 2014.dbo.ocrd t4 on t1.Cardcode = t4.CardCode
inner join [2014].[dbo].[@CQ_RTSM] t5 on t4.U_BeatCode = t5.U_RoutCode
where t2.DcntSum <> 0.000000 and t3.DocDate between [%1] and [%2]You have to create stored procedure in SQL only .
Like u must have create for Crystal .
You can execute procedure in query manager but you have to enter parameter manually..
example
Exec @Test '20140101' '20140501'
Every time user has to enter it manually in yyyymmdd format in case of date parameters.
Example
Create Proc [@Test]
as begin
DECLARE @name AS date
Declare @name2 AS date
/* SELECT FROM [2013].[dbo].[OINV] T0 */
/* WHERE */
select '2013',t5.U_salmannm,t1.CardName,t2.sumapplied as CollectionAmount,t2.DcntSum ,t3.DocTotal as InvoiceTotal,
datediff(dd,t3.DocDate,t1.Docdate) as Days
from 2013.dbo.orct t1
inner join 2013.dbo.RCT2 t2 on t1.DocNum = t2.DocNum
left join 2013.dbo.oinv t3 on
t3.docentry = t2.baseAbs
inner join 2013.dbo.ocrd t4 on t1.Cardcode = t4.CardCode
inner join [2013].[dbo].[@CQ_RTSM] t5 on t4.U_BeatCode = t5.U_RoutCode
where t2.DcntSum <> 0.000000 and t3.DocDate between @Name and @Name2
Union
/* SELECT FROM [2014].[dbo].[OINV] T0 */
/* WHERE */
select '2014',t5.U_salmannm,t1.CardName,t2.sumapplied as CollectionAmount,t2.DcntSum ,t3.DocTotal as InvoiceTotal,
datediff(dd,t3.DocDate,t1.Docdate) as Days
from 2014.dbo.orct t1
inner join 2014.dbo.RCT2 t2 on t1.DocNum = t2.DocNum
left join 2014.dbo.oinv t3 on
t3.docentry = t2.baseAbs
inner join 2014.dbo.ocrd t4 on t1.Cardcode = t4.CardCode
inner join [2014].[dbo].[@CQ_RTSM] t5 on t4.U_BeatCode = t5.U_RoutCode
where t2.DcntSum <> 0.000000 and t3.DocDate between
between @Name and @Name2
end -
Error "Members, tuples or sets must use the same hierarchies in the function" in MDX
the following MDX returns error: "Members, tuples or sets must use the same hierarchies in the function"
WITH
MEMBER [Measures].[Prev Year] AS
[Measures].[returns],
PARALLELPERIOD
[Exec Date].[Year].Levels('Year'),
1,
[Exec Date].[Year].CURRENTMEMBER
MEMBER [Measures].[Prev Month] AS
[Measures].[returns],
PARALLELPERIOD
[Exec Date].[Month Num].Levels('Month Num'),
1,
[Exec Date].[Month Num].CURRENTMEMBER
MEMBER [Measures].[Prev Day] AS
[Measures].[returns],
PARALLELPERIOD
[Exec Date].[Day].Levels('Day'),
1,
[Exec Date].[Day].CURRENTMEMBER
SELECT NON EMPTY { StrToMember("@ExecDateLevel"), [Measures].[returns] } ON COLUMNS, NON EMPTY { ([Employees].[Company].[Company].ALLMEMBERS ) } DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON ROWS FROM (
SELECT (
STRTOSET(@ExecDateHierarchy, CONSTRAINED)
) ON COLUMNS FROM [cbSales]) WHERE ( IIF( STRTOSET(@ExecDateHierarchy, CONSTRAINED).Count = 1, STRTOSET(@ExecDateHierarchy, CONSTRAINED), [Exec Date].[Hierarchy].currentmember ) ) CELL PROPERTIES VALUE, BACK_COLOR, FORE_COLOR, FORMATTED_VALUE, FORMAT_STRING, FONT_NAME, FONT_SIZE, FONT_FLAGS
and when I replace "StrToMember(@ExecDateLevel)" with
StrToMember("[Measures].[Prev Month]") the MDX is compiled correctly.
what is the problem?
How can I solve that?Hi Breceive,
In your scenario, the issue is caused by that you select dimension members and measures on the same axis without a crossjoin.
SELECT NON EMPTY { StrToMember("@ExecDateLevel"), [Measures].[returns] } ON COLUMNS
To avoid this issue, you can use the query below.
WITH
MEMBER [Measures].[Prev Year] AS
[Measures].[returns],
PARALLELPERIOD
[Exec Date].[Year].Levels('Year'),
1,
[Exec Date].[Year].CURRENTMEMBER
MEMBER [Measures].[Prev Month] AS
[Measures].[returns],
PARALLELPERIOD
[Exec Date].[Month Num].Levels('Month Num'),
1,
[Exec Date].[Month Num].CURRENTMEMBER
MEMBER [Measures].[Prev Day] AS
[Measures].[returns],
PARALLELPERIOD
[Exec Date].[Day].Levels('Day'),
1,
[Exec Date].[Day].CURRENTMEMBER
SELECT NON EMPTY { StrToMember("@ExecDateLevel")*[Measures].[returns] } ON COLUMNS, NON EMPTY { ([Employees].[Company].[Company].ALLMEMBERS ) } DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON ROWS FROM (
SELECT (
STRTOSET(@ExecDateHierarchy, CONSTRAINED)
) ON COLUMNS FROM [cbSales]) WHERE ( IIF( STRTOSET(@ExecDateHierarchy, CONSTRAINED).Count = 1, STRTOSET(@ExecDateHierarchy, CONSTRAINED), [Exec Date].[Hierarchy].currentmember ) ) CELL PROPERTIES VALUE, BACK_COLOR, FORE_COLOR, FORMATTED_VALUE, FORMAT_STRING, FONT_NAME, FONT_SIZE, FONT_FLAGS
Here is a similar thread for you reference.
https://social.msdn.microsoft.com/Forums/sqlserver/en-US/3c21d9a8-640d-4dde-bc76-08d1fcbb3a31/multiple-dimension-query?forum=sqlanalysisservices
Regards,
Charlie Liao
TechNet Community Support -
Can I use Count, Max function in PLSQL BLOCK.
Can U help me to use count, max function in PLSQL BLOCK.
Because it is giving me error "It is a SQL function"SELECT COUNT(*)
INTO l_variable
FROM dual;
Will work inside PL/SQL -
Does Oracle implement node set expressions like count( node set ) in it's xpath syntax? If so, can you give me an example indicating how the count( node set ) expression would be used? This function would be extremely useful when iterating through a node set.
Kevin Tysonselect count(*) from purchaseorder
where existsNode(object_value,'/PurchaseOrder[User="SBELL"]') = 1
/
Maybe you are looking for
-
Burning disc transforms NEF files into JPG
Using the Finder method to burn a disc, I find that NEF files (from Nikon D300 camera) become JPG files. Or, at least, they have a .JPG extension (yes, capitalized, as opposed to lower case for jpg files), but they seem to be about the same size as t
-
Hi , I want to do a scneario of transfering IDOC to RFC using XI . incase any one of you has done it and documented the same .Kindly do let me know . Any links to weblogs would also be help full . Thanks Amit
-
My podcast, The Big Seance Podcast, was just added to iTunes today. Other than keeping track of stats through my host (Libsyn), how can I keep track of subscriptions, ratings, and downloads through itunes? Thanks!
-
Dear Sir/Madam, I would like to inform you that, I am facing problem in my lock key since from the last one year after apple change my i phone 5 due to sparking problem in phone at the time of charging. Then apple replace my phone but within few week
-
BOFC 7.5 multiserver environment
Hey experts, i need your help. I'm trying to install SAP BOFC 7.5 on a multiserver environment (database server on a machine, application and webserver on another one). Is there any documentation about this kind of installation for BOFC? The installa