Evaluate math expression
Hi Guys,
I need to write java command line program to evaluate a mathematical
expression input by user without parantheses using Stack approach.
Can anyone give me the clue how to start of with.
Is it possible to evaluate the expression in infix notation directly using stack, without converting to prefix notation.
Thanks in advance
Is there something nicer?You can also use java 6 and javascripts. I saw a
thread where someone posted an example.
KajI posted something a couple of weeks back (reply #2):
http://forum.java.sun.com/thread.jspa?threadID=5137192
Of course, you don't need to bind any variables and can do it like this:import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;
public class ScriptDemo {
public static void main(String[] args) {
ScriptEngineManager manager = new ScriptEngineManager();
ScriptEngine engine = manager.getEngineByName("js");
try {
String expression = "3+4";
Object result = engine.eval(expression);
System.out.println(expression+" = "+result);
} catch(ScriptException se) {
se.printStackTrace();
output: 3+4 = 7.0
*/
Similar Messages
-
How do I render Math expressions in my JSP pages?
Hi,
I am sort of a beginner using JSF. I am currently working on a project, where I need to render Math expressions such as fractions, square-roots, power-functions etc.
The problem is, that currently all I am able to do is to use the standard text operators such as '/', '^' etc. I would like to have 'real' math expressions rendered.
Does anyone know how to do this easiest? Is there any tag-libs available for doing so?
I realize it is doable using HTML, but because of the design of my application, it is not an option to insert HTML directly into the JSP pages.
Thanks in advance :)
Best Regards
ThomasThank you for the quick answer!
My problem is not to do the math, my problem is how to display the math on the JSP page. I want to display fractions, power-functions, square roots with the actual mathmatical symbols, not the symbols mentioned above (/, ^, sqrt, etc.).
Does anyone know how to do this, or if there exists any taglibs? -
Hi all,
I am trying to evaluate a string expression against rows of data. If the data satisfys that condition/expression then its selected otherwirse its not.
To re-iterate how to evaluate a string expression like: "value < 1"
against data values like: 0, 1, 2 ...n
Any help will be appreciated. Thanks in advance.
Here's the code I am using:
* Evaluates the Expression Either return True or False
* @return
public boolean evalExpression() {
boolean retval = true;
// Identify the conditional process step
if (this.isConditional()) {
// get the inputs
for (int i = 0; i < myInputs.size(); i++) {
ContainerDataElement containerDataElement = (ContainerDataElement) myInputs
.elementAt(i);
String data = containerDataElement.getValueAsString();
// Get the conditions
for (int j = 0; j < myProcessConditions.size(); j++) {
ProcessCondition pc = (ProcessCondition) myProcessConditions
.elementAt(j);
Boolean condition = new Boolean(pc.getExpression());
// Evaluate the expression against the data elements
if (condition.booleanValue()) {
retval = true;
else {
retval = false;
return retval;
}ProcessCondion holds the Expression but I need to match the value the expression matches.
A bit like equals example I am trying out now:
public boolean evalExpression() {
boolean retval = true;
// Identify the conditional process step
if (this.isConditional()) {
// get the inputs
for (int i = 0; i < myInputs.size(); i++) {
ContainerDataElement containerDataElement = (ContainerDataElement) myInputs
.elementAt(i);
String data = containerDataElement.getValueAsString();
com.aim.common.DebugLog.debug("dataELEMENTS--------"
+ data.toString());
// Get the conditions
for (int j = 0; j < myProcessConditions.size(); j++) {
ProcessCondition pc = (ProcessCondition) myProcessConditions
.elementAt(j);
com.aim.common.DebugLog.debug("ProcessCondition--------"
+ pc.toString());
Boolean condition = new Boolean(pc.getExpression());
com.aim.common.DebugLog.debug("condition--------"
+ condition.toString());
// Evaluate the expression against the data elements
if (containerDataElement.equals(condition)) {
com.aim.common.DebugLog.debug("conditionEVALUATED--------"
+ retval);
retval = true;
else {
retval = false;
return retval;
} -
The Expression Engine failed to evaluate the expression for a Subportal Act
Anyone seen this error before and know of a fix? We're getting it on our 6.1 MP1 portal after we deployed our custom sso solution.
"62 12-19-2007 12:58:37.292 Error Portal_UI_Infrastructure portal.c27mynrspaxr01.webadm .NET #32 com.plumtree.portaluiinfrastructure.condition.ConditionTypeManager The Expression Engine failed to evaluate the expression for a Subportal Action.
System.NullReferenceException: Object reference not set to an instance of an object.
at com.plumtree.portaluiinfrastructure.condition.ConditionTypeManager.EvaluateExpressionForSubportalAction(AActivitySpace asCurrentSpace, IApplication application, IXPRequest xpRequest, Object ptUserSession) in e:\buildroot\Release\portalui\6.1.x\ptwebui\portaluiinfrastructure\dotnet\prod\src\com\plumtree\portaluiinfrastructure\condition\ConditionTypeManager.cs:line 260 <ptLogMsgEnd>"As far as i know this is a harmless error. Our portal generated that message every time someone browsed /portal/server.pt.
-
XQuery syntax to evaluate math formula
I want to evaluate a math formula inside of a function, so I can't use dynamic SQL.
I found that the query on an XML-variable with a literal works well.
DECLARE @sParsedFormula varchar(200);
DECLARE @xFormula xml;
SET @xFormula = '';
SET @sParsedFormula = '1+2';
SELECT @xFormula.query('3+3') , @xFormula.query('sql:variable("@sParsedFormula")')
Output (1st value is correctly evaluated, 2nd not):
"6", "1+2"
I can't directly pass @sParsedFormula to the query otherwise I get "The argument 1 of the XML data type method "query" must be a string literal".
What is the correct XQuery-syntax to evaluate the SQL:variable?
Tx,
PatrickYou are obviously on the wrong track when you ask for the impossible.
You can use sql:variable in XQuery to provide a value. You cannot provide an
expression.
If you want to pursue the set-up, your function will have to parse the expression and evalaute it. You can do this is in T-SQL, but it is not the best language for string parsing. Count on wast^H^H^H^Hspending quite a few hours on the development.
If you do it in C#, undoubtedly it will be easier, and I would expect that you can find classes that performs the parsing and evaluation. This can reduce your development costs considerably.
Of the languages I have worked with, there is one where the evaluting the expressions are dirt simple: Perl. Here you can just say
$value = eval($expr)
But running Perl code from SQL Server? Nah.
If you want to do this in T-SQL only, it will have to be dynamic SQL. To avoid the cursor you can do somthing like:
SELECT @sql =
(SELECT 'SELECT ' + ltrim(str(id)) + ', ' + expr + ';' + char(13) + char(10)
FROM #temp
FOR XML PATH(''), TYPE).value('.', 'nvarchar(MAX)')
PRINT @sql
INSERT #newtemp(id, value)
EXEC (@sql)
UPDATE #temp
SET value = n.value
FROM #temp t
JOIN #newtemp n ON t.id = n.id
So, yes, XML had a place in your solution. But where you were looking.
But note that with this solution, you will lose it all if one expression does not parse.
Erland Sommarskog, SQL Server MVP, [email protected] -
Using expression trees to evaluate an expression
i have a three parameters like age, sex and location. Now, my users while registration, can specify an expression like, age > 25 and age < 30 and sex = male OR location = 'London'. Now i get an incoming request which has certain values for age, sex and location (say: age=26 sex = male location = 'London'). Then i want to get a list of all the users registered with me who satisfies the incoming criteria. Do you think an expression tree would help me in this case? can pls someone guide me?
actually i have a fixed list of operators and operands. The only variation being that users while registration might use only a subset of those operators and operands e.g. some users may just give an expression such as 'sex=male' and some other users could give an expression such as 'sex = female AND age > 21'. So when i get an incoming request saying sex = female and age = 22 then only my second kind of users would be selected and suppose if i get an incoming message like sex = male , age = 33 then my first kind of users (though no age is specified by that user while registration but still he would be selected as the expression said sex = male and that is one of the parameters of the incoming request) would be selected. Now how do i create such a solution using an expression tree, which would evaluate the incoming request and then match it with the expression specified by the various users to find the list of those users who qualify according to the incoming request parameters. any ideas??
-
Evaluate Regular expression complexity
Hi all
I've a problem on regular expression usage in my application.
I'm using a regular expression to identify objects and fetch them to be served depending on an input string with has to be matched.
each object has a property representing a regular expression to be matched to be candidate for fetching.
my program receive an external input string, then loops on the full objects collection identifying which are the object whose regular expression match the input stream.
doing an example:
obj1) key = "J*SDK"
obj2) key = "Ja*6*"
obj3) key = "JEE*"
if the input string is "Java 6.0 SDK" obj1 and obj2 are cadidate, while obj3 is discarded.
up to now everithing is fine, now here is my question:
i want only one object as output and I want the one best matching my input string.
this means that
-> obj1 is matching 4 chatacter ans has only one wildchar
-> obj2 is matching 3 characters and has two wildcard
so obj2 is discarded since it's regular expression is more complex than the obj1 one
my problem is HOW to evaulate correctly such complexity for each candidate object to be able to choose my best object.
is there some formal rule / api for this?
I'd like to match all wildcards into the regex, but doing this "by hand" would surely result in some bug due to some missing case, so a "third party" API or a grammar rule would be useful.
hoping for you help.
regards
Michele Sacchettiok, after days and days of research i came up to this solution:
1) I used this (http://www.brics.dk/automaton) package for regular expression which let me access the internal state automa data
2) use the getShortestExample() method to retrieve the shortest string matching the given regExp
3) evaluate the Levenshtein Distance between the given string and the one to be matched
PROs:
1) the regexp logic is fully handled by the same state machine which take cares of pattern matching in the first phase
2) the library provide me a non-regexp string to be used with comparison (e.g Levenshtein Distance evaluation)
CONs:
1) the methods getShortestExample is unaware of string to be matched, so if i use "aab|aaa" to match "aab" the method gets the first shortest sort alfabetically, that is "aaa", so I get a LD of 1 even if it should be 0, but it's quite a good deal for my application.
@endasil : your solution rely on grouping, and is based on a pre-parsing done manually so it basically went back to the "manual" parsing i wanted to avoid
Another way I'd like to give a try but had to give up was to use ANTLR (www.antlr.org) to create a parser for regular expression and then evaluating the resulting "tree size" of the parser, but wasn't able to find a formal description of RegExp grammar on the net.
do you have any suggestion or comment on my solution (or other to give a try? ) -
Evaluate binding expressions #{...} from Bean methods?
Hello all,
is it possible to evaluate the binding expressions that are usually given in the JSP page (e.g. #{someObject.someProperty} ) from a Bean method?
I am currently searching for a more convenient way of accessing the resource bundle from a validator and could imagine an access over #{msg.someText}.Hello all,
is it possible to evaluate the binding expressions that are usually given in the JSP page (e.g. #{someObject.someProperty} ) from a Bean method?
I am currently searching for a more convenient way of accessing the resource bundle from a validator and could imagine an access over #{msg.someText}. -
Thread to evaluate arithmetic expressions
I'm trying to write a program that evalutaes arithmetic expression concurrently using Java concurency primitives. The idea behind the threading is to avoid multiple evaluations of common subexpression. I have attached the code that I have written so far but was hoping someone could offer me a hand with the evaluate() and run() methods contained at the end of the program. Thanks.
public class Example {
public static void main(String[] args) {
BinaryOp plus = new BinaryOp() {
public int apply(int n1, int n2) {
return n1 + n2;
BinaryOp times = new BinaryOp() {
public int apply(int n1, int n2) {
return n1 * n2;
Arith e1 = new Operator(plus, new Number(4), new Number(5));
Arith e2 = new Operator(plus,new Operator(times, new Number(3), e1),
new Operator(plus, e1, new Number(6)));
Arith e3 = new Operator(times, e2, e2);
System.out.println(e3.evaluate());
interface BinaryOp {
// An operator that can be applied to two numbers
int apply(int n1, int n2);
interface Arith {
// An arithmetic expression that can be evaluated.
int evaluate();
class Number implements Arith {
private int n;
Number(int n) {
this.n = n;
public int evaluate() { // A number evaluates to itself.
return n;
class Operator implements Arith, Runnable {
private BinaryOp op;
private Arith e1;
private Arith e2;
private boolean done = false;
private int result = 0; // holds the result of previous evaluation
Operator(BinaryOp op, Arith e1, Arith e2) {
this.op = op;
this.e1 = e1;
this.e2 = e2;
(new Thread(this)).start();
public int evaluate() {
public void run() {
}I'm trying to write a program that evalutaes arithmetic expression
concurrently using Java concurency primitives. The idea behind the
threading is to avoid multiple evaluations of common subexpression. Interesting ... the main problem however is to find those common
subexpressions. Most of the evaluation of those common subexpressions
can be done in the parse/compile phase though, effectively elliminating
the need for threads, e.g. (foo+bar)-(foo+bar) can be deduced to be
equal to zero if both 'foo' and 'bar' happen to referential transparent,
i.e. they don't have side effects.
What you're doing now is just starting a new thread for every binary operator.
This is, most likely, not what you want. The strategy of what thread to
start for which subexpression must have layed out the sequence of
threads to start before actual evaluation is started (also see above).
kind regards,
Jos -
Jstl: ExpressionEvaluator.evaluate versus Expression.evaluate
Hi,
Reading the jstl API, I noticed the method ExpressionEvaluator.evaluate().
On the other hand, ExpressionEvaluator also returns an Expression, which has its own evaluation method: Expression.evaluate().
Isn't this redundant ? Which method would be used on which occasion ?
Also, I was wondering: do I understand correctly, that one could override the ExpressionEvaluator ? So if I write my own evaluator, I could make it so that "${2+2}" evaluates to, say, "5" ?
Thanks very much.Hi,
Reading the jstl API, I noticed the method ExpressionEvaluator.evaluate().
On the other hand, ExpressionEvaluator also returns an Expression, which has its own evaluation method: Expression.evaluate().
Isn't this redundant ? Which method would be used on which occasion ?
Also, I was wondering: do I understand correctly, that one could override the ExpressionEvaluator ? So if I write my own evaluator, I could make it so that "${2+2}" evaluates to, say, "5" ?
Thanks very much. -
How does one evaluate an expression stored as a VARCHAR 2 in a table?
I am attempting to write a single SQL statement that will select three columns of data from a table and based on the value of a string in one column perform a calculation using the other two columns. Here is an example. TableX contains three columns. For simplicity sake let's say Col1 and Col2 are Number(5) and Col3 is a VARCHAR2(25).
TableX
Col1 Col2 Col3
5 7 Col1+Col2
10 3 Col1*Col2
20 5 Col1/Col2
I would like to write an SQL statement like 'select Col1, Col2, evaluate(Col3) as "Eval" from TableX' and get the following result set back.
Col1 Col2 Eval
5 7 12
10 3 30
20 5 4
Is there an Oracle provided function like the hypothetical evaluate() provided above that will do this?
One potential solution would be to write a stored procedure that accepts the three columns as parameters and then performs an execute immediate and returns the result. However, I would like a more dynamic utility so I don't have to be resticted to a preset number of columns (3 in this example).
Any ideas would be greatly appreciated.
Thanks,
MattMatthew:
There is no evaluate function in Oracle, and as far as I know, there is no way to do what you want solely in sql. However, this function should do the trick.
SQL> CREATE OR REPLACE FUNCTION my_eval (
2 p_tab_name IN VARCHAR2,
3 p_rowid IN ROWID,
4 p_calc_col IN VARCHAR2) RETURN NUMBER IS
5
6 sqlstr VARCHAR2(4000);
7 result NUMBER;
8 BEGIN
9 sqlstr:= 'SELECT '||p_calc_col||' FROM '||p_tab_name||' WHERE rowid = :b';
10 EXECUTE IMMEDIATE sqlstr INTO result USING p_rowid;
11 RETURN result;
12 END;
13 /
Function created.
SQL> CREATE TABLE jtest (col1 number,col2 number,col3 varchar2(50));
Table created.
SQL> INSERT INTO jtest values (5, 7, 'Col1+Col2');
1 row created.
SQL> INSERT INTO jtest values (10, 3, 'Col1*Col2');
1 row created.
SQL> INSERT INTO jtest values (20, 5, 'Col1/Col2');
1 row created.
SQL> commit;
Commit complete.
SQL> SELECT col1,col2,col3,MY_EVAL('jtest',rowid,col3) evald
2 FROM jtest
3 /
COL1 COL2 COL3 EVALD
5 7 Col1+Col2 12
10 3 Col1*Col2 30
20 5 Col1/Col2 4
SQL> DROP TABLE jtest;
Table dropped.
SQL> CREATE TABLE jtest (col1 number,col2 number,col3 number,col4 varchar2(50));
Table created.
SQL> INSERT INTO jtest values (5, 7, 2, '(Col1+Col2)/Col3');
1 row created.
SQL> INSERT INTO jtest values (10, 3, 5, 'Col1*(Col2+Col3)');
1 row created.
SQL> INSERT INTO jtest values (20, 5, 2, 'Col1/Col2/Col3');
1 row created.
SQL> commit;
Commit complete.
SQL> SELECT col1,col2,col3,col4,MY_EVAL('jtest',rowid,col4) evald
2 FROM jtest;
COL1 COL2 COL3 COL4 EVALD
5 7 2 (Col1+Col2)/Col3 6
10 3 5 Col1*(Col2+Col3) 80
20 5 2 Col1/Col2/Col3 2This could easily be extended to handle character functions as well.
John -
Evaluate xmla expression in a variable
Hi,
I have a xmla code which I'm trying to put it in a variable. While evaluating the expression I'm getting the error as
The expression might contain an invalid token, an incomplete token, or an invalid element. It might not be well-formed, or might be missing part of a required element such as a parenthesis.
Here is my xmla expression
"Select '
<Batch xmlns="http://schemas.microsoft.com/analysisservices/2003/engine">
<ErrorConfiguration xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ddl2="http://schemas.microsoft.com/analysisservices/2003/engine/2" xmlns:ddl2_2="http://schemas.microsoft.com/analysisservices/2003/engine/2/2" xmlns:ddl100_100="http://schemas.microsoft.com/analysisservices/2008/engine/100/100" xmlns:ddl200="http://schemas.microsoft.com/analysisservices/2010/engine/200" xmlns:ddl200_200="http://schemas.microsoft.com/analysisservices/2010/engine/200/200" xmlns:ddl300="http://schemas.microsoft.com/analysisservices/2011/engine/300" xmlns:ddl300_300="http://schemas.microsoft.com/analysisservices/2011/engine/300/300" xmlns:ddl400="http://schemas.microsoft.com/analysisservices/2012/engine/400" xmlns:ddl400_400="http://schemas.microsoft.com/analysisservices/2012/engine/400/400">
<KeyNotFound>IgnoreError</KeyNotFound>
</ErrorConfiguration>
<Parallel>
<Process xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ddl2="http://schemas.microsoft.com/analysisservices/2003/engine/2" xmlns:ddl2_2="http://schemas.microsoft.com/analysisservices/2003/engine/2/2" xmlns:ddl100_100="http://schemas.microsoft.com/analysisservices/2008/engine/100/100" xmlns:ddl200="http://schemas.microsoft.com/analysisservices/2010/engine/200" xmlns:ddl200_200="http://schemas.microsoft.com/analysisservices/2010/engine/200/200" xmlns:ddl300="http://schemas.microsoft.com/analysisservices/2011/engine/300" xmlns:ddl300_300="http://schemas.microsoft.com/analysisservices/2011/engine/300/300" xmlns:ddl400="http://schemas.microsoft.com/analysisservices/2012/engine/400" xmlns:ddl400_400="http://schemas.microsoft.com/analysisservices/2012/engine/400/400">
<Object>
<DatabaseID>IIS_Version2</DatabaseID>
<DimensionID>Application</DimensionID>
</Object>
<Type>ProcessAdd</Type>
<DataSource xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ddl2="http://schemas.microsoft.com/analysisservices/2003/engine/2" xmlns:ddl2_2="http://schemas.microsoft.com/analysisservices/2003/engine/2/2" xmlns:ddl100_100="http://schemas.microsoft.com/analysisservices/2008/engine/100/100" xmlns:ddl200="http://schemas.microsoft.com/analysisservices/2010/engine/200" xmlns:ddl200_200="http://schemas.microsoft.com/analysisservices/2010/engine/200/200" xmlns:ddl300="http://schemas.microsoft.com/analysisservices/2011/engine/300" xmlns:ddl300_300="http://schemas.microsoft.com/analysisservices/2011/engine/300/300" xmlns:ddl400="http://schemas.microsoft.com/analysisservices/2012/engine/400" xmlns:ddl400_400="http://schemas.microsoft.com/analysisservices/2012/engine/400/400" xmlns:dwd="http://schemas.microsoft.com/DataWarehouse/Designer/1.0" xsi:type="RelationalDataSource" dwd:design-time-name="1a3cb292-9bce-4c59-a182-177d6b3506ff" xmlns="http://schemas.microsoft.com/analysisservices/2003/engine">
<ID>IISDW</ID>
<Name>IISDW</Name>
<ConnectionString>Provider=SQLNCLI11.1;Data Source=CO1MSFTSQLHKT02;Integrated Security=SSPI;Initial Catalog=IISDW</ConnectionString>
<!--<ImpersonationInfo>
<ImpersonationMode>ImpersonateAccount</ImpersonationMode>
<Account>phx\v-chveng</Account>
<ImpersonationInfoSecurity>passwordremoved</ImpersonationInfoSecurity>
</ImpersonationInfo>
<Timeout>PT0S</Timeout>-->
</DataSource>
<DataSourceView xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ddl2="http://schemas.microsoft.com/analysisservices/2003/engine/2" xmlns:ddl2_2="http://schemas.microsoft.com/analysisservices/2003/engine/2/2" xmlns:ddl100_100="http://schemas.microsoft.com/analysisservices/2008/engine/100/100" xmlns:ddl200="http://schemas.microsoft.com/analysisservices/2010/engine/200" xmlns:ddl200_200="http://schemas.microsoft.com/analysisservices/2010/engine/200/200" xmlns:ddl300="http://schemas.microsoft.com/analysisservices/2011/engine/300" xmlns:ddl300_300="http://schemas.microsoft.com/analysisservices/2011/engine/300/300" xmlns:ddl400="http://schemas.microsoft.com/analysisservices/2012/engine/400" xmlns:ddl400_400="http://schemas.microsoft.com/analysisservices/2012/engine/400/400" xmlns:dwd="http://schemas.microsoft.com/DataWarehouse/Designer/1.0" dwd:design-time-name="b0b61205-c64d-4e34-afae-6d4d48b93fb3" xmlns="http://schemas.microsoft.com/analysisservices/2003/engine">
<ID>IISDW</ID>
<Name>IISDW</Name>
<DataSourceID>IISDW</DataSourceID>
<Schema>
<xs:schema id="IISDW" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:msprop="urn:schemas-microsoft-com:xml-msprop">
<xs:element name="IISDW" msdata:IsDataSet="true" msdata:UseCurrentLocale="true" msprop:design-time-name="a6676059-1f9d-4cf2-8dcf-40b8f31e3332">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="Application" msprop:design-time-name="6022ab52-0da7-49db-a3d3-b38704d0559b" msprop:IsLogical="True" msprop:FriendlyName="Application" msprop:DbTableName="Application" msprop:TableType="View" msprop:Description="" msprop:QueryDefinition="SELECT Application, DATEADD([hour], DATEDIFF([hour], 0, [Timestamp]), 0) AS [Timestamp], ServerName, CAST(ServerName AS char(3)) AS DataCenter, CS_URI_Stem, CAST(HashBytes("'MD5'",Application + ServerName + CS_URI_Stem + CAST(DATEADD([hour], DATEDIFF([hour], 0, [Timestamp]), 0) AS varchar(24))) AS uniqueidentifier) AS Server_URI_Identity
FROM IIS_6 AS a LEFT OUTER JOIN
Dimension_Pointer AS b ON a.Application = b.Application
WHERE (b.ProcessedFlag = 0) AND (a.Application = "+(DT_WSTR, 100) @[User::Application]+")
GROUP BY Application, DATEADD([hour], DATEDIFF([hour], 0, [Timestamp]), 0), ServerName, CS_URI_Stem" msprop:QueryBuilder="SpecificQueryBuilder">
<xs:complexType>
<xs:sequence>
<xs:element name="Application" msprop:design-time-name="8b794def-ecf7-48c5-8f41-8829e00cf235" msprop:DbColumnName="Application" msprop:FriendlyName="Application" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="255" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Timestamp" msdata:ReadOnly="true" msprop:design-time-name="00274b1e-7459-4197-8a22-f2f5de0c4af1" msprop:DbColumnName="Timestamp" msprop:FriendlyName="Timestamp" type="xs:dateTime" />
<xs:element name="ServerName" msprop:design-time-name="793900a3-304a-45a4-8f3f-87352b3fb70f" msprop:DbColumnName="ServerName" msprop:FriendlyName="ServerName" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="255" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="DataCenter" msdata:ReadOnly="true" msprop:design-time-name="6cfa5bef-833b-4ac1-bfde-1b7a89516140" msprop:DbColumnName="DataCenter" msprop:FriendlyName="DataCenter" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="3" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="CS_URI_Stem" msprop:design-time-name="4cee9248-c545-4ff1-8887-c553e2932403" msprop:DbColumnName="CS_URI_Stem" msprop:FriendlyName="CS_URI_Stem" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="4000" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Server_URI_Identity" msdata:DataType="System.Guid, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" msdata:ReadOnly="true" msprop:design-time-name="6666d716-ac3c-4a5a-a331-9398a6bbd8cc" msprop:DbColumnName="Server_URI_Identity" msprop:FriendlyName="Server_URI_Identity" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
<xs:unique name="Constraint1" msprop:IsLogical="True" msdata:PrimaryKey="true">
<xs:selector xpath=".//Application" />
<xs:field xpath="Server_URI_Identity" />
<xs:field xpath="Timestamp" />
</xs:unique>
</xs:element>
</xs:schema>
<IISDW xmlns="" />
</Schema>
</DataSourceView>
<WriteBackTableCreation>UseExisting</WriteBackTableCreation>
</Process>
</Parallel>
</Batch>' as ProcesAdd
can anyone help me plzHi Katherine,
Thanks for your reply;
Here is my Control flow which gives you some idea what I'm trying to do:
I'm using a for each loop container and inside it I have a Execute SQL task which generate the XMLA script (which I have passed it in a variable for which I used the connection type as ADO.net ); later I have written a script to check wheather it is returning
the correct xmla script or not and than processing the dimension.
Everything works good until the Script task and when it comes to the Process ADD it fails.
EXECUTE SQL TASK (Get XMLA Query processADD) variable value:
"SELECT '<Batch xmlns=\"http://schemas.microsoft.com/analysisservices/2003/engine\">
<ErrorConfiguration xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:ddl2=\"http://schemas.microsoft.com/analysisservices/2003/engine/2\" xmlns:ddl2_2=\"http://schemas.microsoft.com/analysisservices/2003/engine/2/2\" xmlns:ddl100_100=\"http://schemas.microsoft.com/analysisservices/2008/engine/100/100\" xmlns:ddl200=\"http://schemas.microsoft.com/analysisservices/2010/engine/200\" xmlns:ddl200_200=\"http://schemas.microsoft.com/analysisservices/2010/engine/200/200\" xmlns:ddl300=\"http://schemas.microsoft.com/analysisservices/2011/engine/300\" xmlns:ddl300_300=\"http://schemas.microsoft.com/analysisservices/2011/engine/300/300\" xmlns:ddl400=\"http://schemas.microsoft.com/analysisservices/2012/engine/400\" xmlns:ddl400_400=\"http://schemas.microsoft.com/analysisservices/2012/engine/400/400\">
<KeyNotFound>IgnoreError</KeyNotFound>
</ErrorConfiguration>
<Parallel>
<Process xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:ddl2=\"http://schemas.microsoft.com/analysisservices/2003/engine/2\" xmlns:ddl2_2=\"http://schemas.microsoft.com/analysisservices/2003/engine/2/2\" xmlns:ddl100_100=\"http://schemas.microsoft.com/analysisservices/2008/engine/100/100\" xmlns:ddl200=\"http://schemas.microsoft.com/analysisservices/2010/engine/200\" xmlns:ddl200_200=\"http://schemas.microsoft.com/analysisservices/2010/engine/200/200\" xmlns:ddl300=\"http://schemas.microsoft.com/analysisservices/2011/engine/300\" xmlns:ddl300_300=\"http://schemas.microsoft.com/analysisservices/2011/engine/300/300\" xmlns:ddl400=\"http://schemas.microsoft.com/analysisservices/2012/engine/400\" xmlns:ddl400_400=\"http://schemas.microsoft.com/analysisservices/2012/engine/400/400\">
<Object> <DatabaseID>IIS_Version2</DatabaseID> <DimensionID>Application</DimensionID>
</Object>
<Type>ProcessAdd</Type>
<DataSource xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:ddl2=\"http://schemas.microsoft.com/analysisservices/2003/engine/2\" xmlns:ddl2_2=\"http://schemas.microsoft.com/analysisservices/2003/engine/2/2\" xmlns:ddl100_100=\"http://schemas.microsoft.com/analysisservices/2008/engine/100/100\" xmlns:ddl200=\"http://schemas.microsoft.com/analysisservices/2010/engine/200\" xmlns:ddl200_200=\"http://schemas.microsoft.com/analysisservices/2010/engine/200/200\" xmlns:ddl300=\"http://schemas.microsoft.com/analysisservices/2011/engine/300\" xmlns:ddl300_300=\"http://schemas.microsoft.com/analysisservices/2011/engine/300/300\" xmlns:ddl400=\"http://schemas.microsoft.com/analysisservices/2012/engine/400\" xmlns:ddl400_400=\"http://schemas.microsoft.com/analysisservices/2012/engine/400/400\" xmlns:dwd=\"http://schemas.microsoft.com/DataWarehouse/Designer/1.0\" xsi:type=\"RelationalDataSource\" dwd:design-time-name=\"1a3cb292-9bce-4c59-a182-177d6b3506ff\" xmlns=\"http://schemas.microsoft.com/analysisservices/2003/engine\">
<ID>IISDW</ID>
<Name>IISDW</Name>
<ConnectionString>Provider=SQLNCLI11.1;Data Source=CO1MSFTSQLHKT02;Integrated Security=SSPI;Initial Catalog=IISDW</ConnectionString>
<Timeout>PT0S</Timeout>-->
</DataSource>
<DataSourceView xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:ddl2=\"http://schemas.microsoft.com/analysisservices/2003/engine/2\" xmlns:ddl2_2=\"http://schemas.microsoft.com/analysisservices/2003/engine/2/2\" xmlns:ddl100_100=\"http://schemas.microsoft.com/analysisservices/2008/engine/100/100\" xmlns:ddl200=\"http://schemas.microsoft.com/analysisservices/2010/engine/200\" xmlns:ddl200_200=\"http://schemas.microsoft.com/analysisservices/2010/engine/200/200\" xmlns:ddl300=\"http://schemas.microsoft.com/analysisservices/2011/engine/300\" xmlns:ddl300_300=\"http://schemas.microsoft.com/analysisservices/2011/engine/300/300\" xmlns:ddl400=\"http://schemas.microsoft.com/analysisservices/2012/engine/400\" xmlns:ddl400_400=\"http://schemas.microsoft.com/analysisservices/2012/engine/400/400\" xmlns:dwd=\"http://schemas.microsoft.com/DataWarehouse/Designer/1.0\" dwd:design-time-name=\"b0b61205-c64d-4e34-afae-6d4d48b93fb3\" xmlns=\"http://schemas.microsoft.com/analysisservices/2003/engine\">
<ID>IISDW</ID>
<Name>IISDW</Name>
<DataSourceID>IISDW</DataSourceID>
<Schema> <xs:schema id=\"IISDW_x0020_1\" xmlns=\"\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" xmlns:msdata=\"urn:schemas-microsoft-com:xml-msdata\" xmlns:msprop=\"urn:schemas-microsoft-com:xml-msprop\">
<xs:element name=\"IISDW_x0020_1\" msdata:IsDataSet=\"true\" msdata:UseCurrentLocale=\"true\" msprop:design-time-name=\"72037318-e316-469d-9a45-a10c77709b39\">
<xs:complexType>
<xs:choice minOccurs=\"0\" maxOccurs=\"unbounded\">
<xs:element name=\"Application\" msprop:design-time-name=\"7f579e7e-e8b7-4a9d-8a93-a255fccbbfbe\" msprop:IsLogical=\"True\" msprop:FriendlyName=\"Application\" msprop:DbTableName=\"Application\" msprop:TableType=\"View\" msprop:Description=\"\" msprop:QueryDefinition=\"SELECT a.Application, DATEADD([hour], DATEDIFF([hour], 0, a.[Timestamp]), 0) AS [Timestamp], a.ServerName, CAST(a.ServerName AS char(3)) AS DataCenter, a.CS_URI_Stem, CAST(HashBytes(''MD5'', 
 a.Application + a.ServerName + a.CS_URI_Stem + CAST(DATEADD([hour], DATEDIFF([hour], 0, a.[Timestamp]), 0) AS varchar(24))) AS uniqueidentifier) AS Server_URI_Identity
FROM IIS_6_OLD AS a LEFT OUTER JOIN
 Dimension_Pointer AS b ON a.Application = b.Application
WHERE (b.ProcessedFlag = 0) AND (a.Application IN ("+(DT_WSTR,100) @[User::strDistinctApplication]+"))
GROUP BY a.Application, DATEADD([hour], DATEDIFF([hour], 0, a.[Timestamp]), 0), a.ServerName, a.CS_URI_Stem\" msprop:QueryBuilder=\"SpecificQueryBuilder\">
<xs:complexType>
<xs:sequence>
<xs:element name=\"Application\" msprop:design-time-name=\"f3074e98-4a82-4bc5-a818-916203f7758b\" msprop:DbColumnName=\"Application\" msprop:FriendlyName=\"Application\" minOccurs=\"0\">
<xs:simpleType>
<xs:restriction base=\"xs:string\">
<xs:maxLength value=\"255\" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name=\"Timestamp\" msdata:ReadOnly=\"true\" msprop:design-time-name=\"2662e3a8-8b1a-4d77-aecb-575329b84dc1\" msprop:DbColumnName=\"Timestamp\" msprop:FriendlyName=\"Timestamp\" type=\"xs:dateTime\" />
<xs:element name=\"ServerName\" msprop:design-time-name=\"ced26d49-cd6e-4073-a40c-ff5ef70e4ef1\" msprop:DbColumnName=\"ServerName\" msprop:FriendlyName=\"ServerName\" minOccurs=\"0\">
<xs:simpleType>
<xs:restriction base=\"xs:string\">
<xs:maxLength value=\"255\" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name=\"DataCenter\" msdata:ReadOnly=\"true\" msprop:design-time-name=\"4583e15a-dcf1-45a2-a30b-bd142ca8b778\" msprop:DbColumnName=\"DataCenter\" msprop:FriendlyName=\"DataCenter\" minOccurs=\"0\">
<xs:simpleType>
<xs:restriction base=\"xs:string\">
<xs:maxLength value=\"3\" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name=\"CS_URI_Stem\" msprop:design-time-name=\"10db5a79-8d50-49d2-9376-a3b4d19864b9\" msprop:DbColumnName=\"CS_URI_Stem\" msprop:FriendlyName=\"CS_URI_Stem\" minOccurs=\"0\">
<xs:simpleType>
<xs:restriction base=\"xs:string\">
<xs:maxLength value=\"4000\" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name=\"Server_URI_Identity\" msdata:DataType=\"System.Guid, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\" msdata:ReadOnly=\"true\" msprop:design-time-name=\"018ede0a-e15e-47c2-851b-f4431e8c839c\" msprop:DbColumnName=\"Server_URI_Identity\" msprop:FriendlyName=\"Server_URI_Identity\" type=\"xs:string\" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
<xs:unique name=\"Constraint1\" msprop:IsLogical=\"True\" msdata:PrimaryKey=\"true\">
<xs:selector xpath=\".//Application\" />
<xs:field xpath=\"Server_URI_Identity\" />
<xs:field xpath=\"Timestamp\" />
</xs:unique>
</xs:element>
</xs:schema>
<IISDW_x0020_1 xmlns=\"\" />
</Schema>
</DataSourceView>
<WriteBackTableCreation>UseExisting</WriteBackTableCreation>
</Process>
</Parallel>
</Batch>' as XMLAScript_ProcessData"
The Result in the SCRIPT Task does show me the correct XMLA code but when it passes to the "PROCESSADD" Analysis Execute DDL task it fails.
And for validation I have included a breakpoint at the ANALYSIS Service Execute DDl Task (Process ADD) and When I see the value of the variable, I see it as
<Batch xmlns=\"http://schemas.microsoft.com/analysisservices/2003/engine\">\n\t<ErrorConfiguration xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:ddl2=\"http://schemas.microsoft.com/analysisservices/2003/engine/2\" xmlns:ddl2_2=\"http://schemas.microsoft.com/analysisservices/2003/engine/2/2\" xmlns:ddl100_100=\"http://schemas.microsoft.com/analysisservices/2008/engine/100/100\" xmlns:ddl200=\"http://schemas.microsoft.com/analysisservices/2010/engine/200\" xmlns:ddl200_200=\"http://schemas.microsoft.com/analysisservices/2010/engine/200/200\" xmlns:ddl300=\"http://schemas.microsoft.com/analysisservices/2011/engine/300\" xmlns:ddl300_300=\"http://schemas.microsoft.com/analysisservices/2011/engine/300/300\" xmlns:ddl400=\"http://schemas.microsoft.com/analysisservices/2012/engine/400\" xmlns:ddl400_400=\"http://schemas.microsoft.com/analysisservices/2012/engine/400/400\">\n\t\t<KeyNotFound>IgnoreError</KeyNotFound>\n\t</ErrorConfiguration>\n\t<Parallel>\n <Process xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:ddl2=\"http://schemas.microsoft.com/analysisservices/2003/engine/2\" xmlns:ddl2_2=\"http://schemas.microsoft.com/analysisservices/2003/engine/2/2\" xmlns:ddl100_100=\"http://schemas.microsoft.com/analysisservices/2008/engine/100/100\" xmlns:ddl200=\"http://schemas.microsoft.com/analysisservices/2010/engine/200\" xmlns:ddl200_200=\"http://schemas.microsoft.com/analysisservices/2010/engine/200/200\" xmlns:ddl300=\"http://schemas.microsoft.com/analysisservices/2011/engine/300\" xmlns:ddl300_300=\"http://schemas.microsoft.com/analysisservices/2011/engine/300/300\" xmlns:ddl400=\"http://schemas.microsoft.com/analysisservices/2012/engine/400\" xmlns:ddl400_400=\"http://schemas.microsoft.com/analysisservices/2012/engine/400/400\">\n <Object> <DatabaseID>IIS_Version2</DatabaseID> <DimensionID>Application</DimensionID>\n </Object>\n <Type>ProcessAdd</Type>\n\t \t<DataSource xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:ddl2=\"http://schemas.microsoft.com/analysisservices/2003/engine/2\" xmlns:ddl2_2=\"http://schemas.microsoft.com/analysisservices/2003/engine/2/2\" xmlns:ddl100_100=\"http://schemas.microsoft.com/analysisservices/2008/engine/100/100\" xmlns:ddl200=\"http://schemas.microsoft.com/analysisservices/2010/engine/200\" xmlns:ddl200_200=\"http://schemas.microsoft.com/analysisservices/2010/engine/200/200\" xmlns:ddl300=\"http://schemas.microsoft.com/analysisservices/2011/engine/300\" xmlns:ddl300_300=\"http://schemas.microsoft.com/analysisservices/2011/engine/300/300\" xmlns:ddl400=\"http://schemas.microsoft.com/analysisservices/2012/engine/400\" xmlns:ddl400_400=\"http://schemas.microsoft.com/analysisservices/2012/engine/400/400\" xmlns:dwd=\"http://schemas.microsoft.com/DataWarehouse/Designer/1.0\" xsi:type=\"RelationalDataSource\" dwd:design-time-name=\"1a3cb292-9bce-4c59-a182-177d6b3506ff\" xmlns=\"http://schemas.microsoft.com/analysisservices/2003/engine\">\n\t\t\t<ID>IISDW</ID>\n\t\t\t<Name>IISDW</Name>\n\t\t\t<ConnectionString>Provider=SQLNCLI11.1;Data Source=CO1MSFTSQLHKT02;Integrated Security=SSPI;Initial Catalog=IISDW</ConnectionString>\n\t\t\t<Timeout>PT0S</Timeout>-->\n\t\t</DataSource>\n\t\t<DataSourceView xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:ddl2=\"http://schemas.microsoft.com/analysisservices/2003/engine/2\" xmlns:ddl2_2=\"http://schemas.microsoft.com/analysisservices/2003/engine/2/2\" xmlns:ddl100_100=\"http://schemas.microsoft.com/analysisservices/2008/engine/100/100\" xmlns:ddl200=\"http://schemas.microsoft.com/analysisservices/2010/engine/200\" xmlns:ddl200_200=\"http://schemas.microsoft.com/analysisservices/2010/engine/200/200\" xmlns:ddl300=\"http://schemas.microsoft.com/analysisservices/2011/engine/300\" xmlns:ddl300_300=\"http://schemas.microsoft.com/analysisservices/2011/engine/300/300\" xmlns:ddl400=\"http://schemas.microsoft.com/analysisservices/2012/engine/400\" xmlns:ddl400_400=\"http://schemas.microsoft.com/analysisservices/2012/engine/400/400\" xmlns:dwd=\"http://schemas.microsoft.com/DataWarehouse/Designer/1.0\" dwd:design-time-name=\"b0b61205-c64d-4e34-afae-6d4d48b93fb3\" xmlns=\"http://schemas.microsoft.com/analysisservices/2003/engine\">\n\t\t\t<ID>IISDW</ID>\n\t\t\t<Name>IISDW</Name>\n\t\t\t<DataSourceID>IISDW</DataSourceID>\n\t\t\t <Schema> <xs:schema id=\"IISDW_x0020_1\" xmlns=\"\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" xmlns:msdata=\"urn:schemas-microsoft-com:xml-msdata\" xmlns:msprop=\"urn:schemas-microsoft-com:xml-msprop\">\n\t\t\t\t\t\t\t <xs:element name=\"IISDW_x0020_1\" msdata:IsDataSet=\"true\" msdata:UseCurrentLocale=\"true\" msprop:design-time-name=\"72037318-e316-469d-9a45-a10c77709b39\">\n\t\t\t\t\t\t\t\t<xs:complexType>\n\t\t\t\t\t\t\t\t <xs:choice minOccurs=\"0\" maxOccurs=\"unbounded\">\n\t\t\t\t\t\t\t\t\t<xs:element name=\"Application\" msprop:design-time-name=\"7f579e7e-e8b7-4a9d-8a93-a255fccbbfbe\" msprop:IsLogical=\"True\" msprop:FriendlyName=\"Application\" msprop:DbTableName=\"Application\" msprop:TableType=\"View\" msprop:Description=\"\" msprop:QueryDefinition=\"SELECT a.Application, DATEADD([hour], DATEDIFF([hour], 0, a.[Timestamp]), 0) AS [Timestamp], a.ServerName, CAST(a.ServerName AS char(3)) AS DataCenter, a.CS_URI_Stem, CAST(HashBytes('MD5', 
 a.Application + a.ServerName + a.CS_URI_Stem + CAST(DATEADD([hour], DATEDIFF([hour], 0, a.[Timestamp]), 0) AS varchar(24))) AS uniqueidentifier) AS Server_URI_Identity
FROM IIS_6_OLD AS a LEFT OUTER JOIN
 Dimension_Pointer AS b ON a.Application = b.Application
WHERE (b.ProcessedFlag = 0) AND (a.Application IN (search))
GROUP BY a.Application, DATEADD([hour], DATEDIFF([hour], 0, a.[Timestamp]), 0), a.ServerName, a.CS_URI_Stem\" msprop:QueryBuilder=\"SpecificQueryBuilder\">\n\t\t\t\t\t\t\t\t\t <xs:complexType>\n\t\t\t\t\t\t\t\t\t\t<xs:sequence>\n\t\t\t\t\t\t\t\t\t\t <xs:element name=\"Application\" msprop:design-time-name=\"f3074e98-4a82-4bc5-a818-916203f7758b\" msprop:DbColumnName=\"Application\" msprop:FriendlyName=\"Application\" minOccurs=\"0\">\n\t\t\t\t\t\t\t\t\t\t\t<xs:simpleType>\n\t\t\t\t\t\t\t\t\t\t\t <xs:restriction base=\"xs:string\">\n\t\t\t\t\t\t\t\t\t\t\t\t<xs:maxLength value=\"255\" />\n\t\t\t\t\t\t\t\t\t\t\t </xs:restriction>\n\t\t\t\t\t\t\t\t\t\t\t</xs:simpleType>\n\t\t\t\t\t\t\t\t\t\t </xs:element>\n\t\t\t\t\t\t\t\t\t\t <xs:element name=\"Timestamp\" msdata:ReadOnly=\"true\" msprop:design-time-name=\"2662e3a8-8b1a-4d77-aecb-575329b84dc1\" msprop:DbColumnName=\"Timestamp\" msprop:FriendlyName=\"Timestamp\" type=\"xs:dateTime\" />\n\t\t\t\t\t\t\t\t\t\t <xs:element name=\"ServerName\" msprop:design-time-name=\"ced26d49-cd6e-4073-a40c-ff5ef70e4ef1\" msprop:DbColumnName=\"ServerName\" msprop:FriendlyName=\"ServerName\" minOccurs=\"0\">\n\t\t\t\t\t\t\t\t\t\t\t<xs:simpleType>\n\t\t\t\t\t\t\t\t\t\t\t <xs:restriction base=\"xs:string\">\n\t\t\t\t\t\t\t\t\t\t\t\t<xs:maxLength value=\"255\" />\n\t\t\t\t\t\t\t\t\t\t\t </xs:restriction>\n\t\t\t\t\t\t\t\t\t\t\t</xs:simpleType>\n\t\t\t\t\t\t\t\t\t\t </xs:element>\n\t\t\t\t\t\t\t\t\t\t <xs:element name=\"DataCenter\" msdata:ReadOnly=\"true\" msprop:design-time-name=\"4583e15a-dcf1-45a2-a30b-bd142ca8b778\" msprop:DbColumnName=\"DataCenter\" msprop:FriendlyName=\"DataCenter\" minOccurs=\"0\">\n\t\t\t\t\t\t\t\t\t\t\t<xs:simpleType>\n\t\t\t\t\t\t\t\t\t\t\t <xs:restriction base=\"xs:string\">\n\t\t\t\t\t\t\t\t\t\t\t\t<xs:maxLength value=\"3\" />\n\t\t\t\t\t\t\t\t\t\t\t </xs:restriction>\n\t\t\t\t\t\t\t\t\t\t\t</xs:simpleType>\n\t\t\t\t\t\t\t\t\t\t </xs:element>\n\t\t\t\t\t\t\t\t\t\t <xs:element name=\"CS_URI_Stem\" msprop:design-time-name=\"10db5a79-8d50-49d2-9376-a3b4d19864b9\" msprop:DbColumnName=\"CS_URI_Stem\" msprop:FriendlyName=\"CS_URI_Stem\" minOccurs=\"0\">\n\t\t\t\t\t\t\t\t\t\t\t<xs:simpleType>\n\t\t\t\t\t\t\t\t\t\t\t <xs:restriction base=\"xs:string\">\n\t\t\t\t\t\t\t\t\t\t\t\t<xs:maxLength value=\"4000\" />\n\t\t\t\t\t\t\t\t\t\t\t </xs:restriction>\n\t\t\t\t\t\t\t\t\t\t\t</xs:simpleType>\n\t\t\t\t\t\t\t\t\t\t </xs:element>\n\t\t\t\t\t\t\t\t\t\t <xs:element name=\"Server_URI_Identity\" msdata:DataType=\"System.Guid, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\" msdata:ReadOnly=\"true\" msprop:design-time-name=\"018ede0a-e15e-47c2-851b-f4431e8c839c\" msprop:DbColumnName=\"Server_URI_Identity\" msprop:FriendlyName=\"Server_URI_Identity\" type=\"xs:string\" />\n\t\t\t\t\t\t\t\t\t\t</xs:sequence>\n\t\t\t\t\t\t\t\t\t </xs:complexType>\n\t\t\t\t\t\t\t\t\t</xs:element>\n </xs:choice>\n </xs:complexType>\n <xs:unique name=\"Constraint1\" msprop:IsLogical=\"True\" msdata:PrimaryKey=\"true\">\n <xs:selector xpath=\".//Application\" />\n <xs:field xpath=\"Server_URI_Identity\" />\n <xs:field xpath=\"Timestamp\" />\n </xs:unique>\n </xs:element>\n </xs:schema>\n <IISDW_x0020_1 xmlns=\"\" />\n </Schema>\n\t\t</DataSourceView>\n\t <WriteBackTableCreation>UseExisting</WriteBackTableCreation>\n </Process>\n </Parallel>\n</Batch>
Here is the error message I get:
[Analysis Services Execute DDL Task] Error: The -->
text node at line 21, column 3 cannot appear inside the DataSource element (namespace http://schemas.microsoft.com/analysisservices/2003/engine) under Envelope/Body/Execute/Command/Batch/Parallel/Process.
This element can only have text nodes containing white-space characters. -
Evaluate XPath expression using SAXON/JAXP/JDOM
I have a somewhat unique requirement. Working on a legacy application with XML code / libraries littered all over the place. Trying to improve performance.
First requirement (to avoid massive refactoring):
Can I use Saxon to process Xpath Expressions using the JAXP apis (because this is what's used in the app currently) on JDOM documents?
I'm not familiar with saxon api enough....any help/code samples is appreciated.
Edited by: pojomojo on Jan 7, 2011 1:02 PMThe Saxon product/feature matrix from the Saxon website says you can: http://www.saxonica.com/feature-matrix.html.
-
Tomcat 6 failing to evaluate EL expressions, Tomcat 6 bug?!!!!
Can someone please tell me this is not a bug in Tomcat 6, its too obvious and to some extend unacceptable I must be doing something wrong.
Here is my problem, I have written my own custom component to display a div tag.
the JSP is as follows:
<faces:view>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>My Custom Tags</title>
</head>
<body>
<html:form>
<h2>Cat In The Rain</h2>
<mine:mytag title="#{index.title}">Dancing in the rain.</mine:mytag>
</html:form>
</body>
</html>
</faces:view>The tag class is given below:
This text #{index.title} is being interpreted as Literal text which is obviously wrong, when deployed in glassfish the code works fine.
Output text in my tomcat console is
MyTag.setProperties(): Title is literal text....
MyTag.setProperties(): title value= #{index.title}
MyTag.setProperties(): Title Value expression is null
The Tag class.
public class MyTag extends UIComponentELTag{
private ValueExpression title;
public String getComponentType() {
return "test.MyOutput";
public String getRendererType() {
return "test.MyRenderer";
@Override()
protected void setProperties(UIComponent component) {
super.setProperties(component);
if (null!= title){
if (!title.isLiteralText()){
component.setValueExpression("component.title", title);
System.out.println("MyTag.setProperties(): Its not literal text.");
System.out.println("MyTag.setProperties (): title value = "+ title.getValue(getELContext()));
else{
component.getAttributes().put("component.title", title.getExpressionString());
System.out.println ("MyTag.setProperties(): Title is literal text....");
System.out.println("MyTag.setProperties(): title value= "+ title.getExpressionString());
System.out.println ("MyTag.setProperties(): Title Value expression is "+ component.getValueExpression("component.title"));
}The component class.
public class MyOutput extends UICommand{
public MyOutput(){
setRendererType("test.MyRenderer");
@Override()
public String getFamily() {
return "test.MyOutput";
}The tld file
<?xml version=" 1.0 " encoding="UTF-8"?>
<taglib version="2.0"
xmlns="http://java.sun.com/xml/ns/j2ee "
xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee web-jsptaglibrary_2_0.xsd">
<tlib-version> 1.0</tlib-version>
<short-name>mine</short-name>
<uri>http://www.my-tests.com </uri>
<tag>
<name>mytag</name>
<tag-class> test.MyTag</tag-class>
<body-content>JSP</body
-content>
<description></description>
<attribute>
<name>binding</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<deferred-value>
<type>test.MyOutput</type>
</deferred-value>
<description>
A ValueExpression that resolves to the UIComponent that corresponds
to this tag. This binding allows the Java bean that contains the UIComponent
to manipulate the UIComponent, its properties, and its children.
</description>
</attribute>
<attribute>
<name>title</name>
<required>false</required>
<deferred-value>
<type>java.lang.String</type>
</deferred-value>
<description></description>
</attribute>
<attribute>
<name>rendered</name>
<required>false</required>
<deferred-value>
<type>boolean</type>
</deferred-value>
<description><![CDATA[ Use the rendered attribute to indicate whether the HTML code for the
component should be included in the rendered HTML page. If set to false,
the rendered HTML page does not include the HTML for the component. If
the component is not rendered, it is also not processed on any subsequent
form submission.
]]></description>
</attribute>
<attribute>
<name>id</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
</taglib>Set the JSP version in your TLD to 2.1.
Meaning from:
<taglib version="2.0"
xmlns="http://java.sun.com/xml/ns/j2ee "
xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee web-jsptaglibrary_2_0.xsd">to:
<taglib version="2.1"
xmlns="http://java.sun.com/xml/ns/j2ee "
xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee web-jsptaglibrary_2_0.xsd">Edited by: rlubke on Oct 15, 2007 9:32 PM -
Running Oracle 10g on Solaris 10 SPARC
I have this expression within a query that I would like to round off to the nearest hundreths:
select (x.VALUE/4800.00)*100 as Percentage,
Value is equal to: 4145.22 I want the display to be:86.35 not 86.35875 (or 86.36 if we can round up/down versus truncation)
ThanksME_XE?select round(86.35875, 2) from dual;
ROUND(86.35875,2)
86.36
1 row selected.
Elapsed: 00:00:00.81
ME_XE?
ME_XE?select round(86.35375, 2) from dual;
ROUND(86.35375,2)
86.35
1 row selected.
Elapsed: 00:00:00.31
Maybe you are looking for
-
Hi. I'm trying to make my guest network disappear from the list of network choices that appears to everyone in the neighborhood. Even though I followed the great suggestions on how to delete the network, it's still appearing in the list that everyo
-
How to find out the exact culpirit session
How to find out the exact culpirit client machine process to kill the session and release. Thanks,
-
After update, now when I go to FB I can no longer go through notifications and see replies or click on links to go to something. Any ideas what happened and how to fix this?
-
Java 1.4.2-where to download?
For a work application accessed over the internet, I need to run java 1.4.2 specifically. I haven't been able to find a site to download this yet--does anyone have a link I could use? (no longer supported by Sun) FYI--using current MBP, Snow Leopard.
-
Dear friends, I want to add new column in Customer Line item i.e.in FBL5N,say I want to add payment amount in FBL5N.I knew the table name but from where I will get field name,Plz tell me the menu path. Thanks in Advance !!