on 04-20-2015 11:55 AM
Hi Experts,
I am using a MDO query action block in a transaction. I am trying to select view columns from a MDO for which I've written the query in Query tab of Configure Links. However, on running the transaction I get the foll. error-
I have configured the Query, MDO, Mode and Attribute Values.
Foll. is my query:
"Select count(*) from [MDO_NAME]
where
[COLNAME] like '[AttributeValue.1]' AND
CONVERT(DATETIME,[COLNAME],110) >=CONVERT(DATETIME,'[AttributeValue.2]',110) AND
CONVERT(DATETIME,[COLNAME],110) <=CONVERT(DATETIME,'[AttributeValue.3]' ,110)AND
[COLNAME] like '[AttributeValue.4]'
AND [COLNAME] like '[AttributeValue.5]'"
I also tried to use a simple select statement as select column name from mdo name- this also gave me the same error.
Is there a syntax issue wrt MDO? Also, can we use the stringif function in query tab of MDO configure links?
Thanks
Rajeev
Hi Rajeev,
You should update following links:
Attributes with "ColumnName" and Mode with "Select".
Leave the mode blank in template, just select the source. No query is required to be supplied in this case.
Only this two properties along with parameters for filter would be enough to run your query.
Thanks,
Swaroop
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Swaroop, however the count gives all the records in that MDO. I've a condition for which I've used stringif function in query part of MDO link...and I need the count as per the condition:-
elect count(*) from [MDO_NAME]
where
[COLNAME] like '[AttributeValue.1]' AND
CONVERT(DATETIME,[COLNAME],110) >=CONVERT(DATETIME,'[AttributeValue.2]',110) AND
CONVERT(DATETIME,[COLNAME],110) <=CONVERT(DATETIME,'[AttributeValue.3]' ,110)AND
[COLNAME] like '[AttributeValue.4]'
AND [COLNAME] like '[AttributeValue.5]'
Or is there another alternative to specify conditions elsewhere in the MdO link actions and get the count as per the query condition?
Thanks
Rajeev
Hi Swaroop,
Thanks. I have configured my mdo action block like:-
mode-"Select"
attributes-"count(*)"
mdo-path of mdo
filterexpr- stringif(condition,
"[DATE_TIME] >='%#Transaction.StartDateTime#%' AND
[DATE_TIME]<='%#Transaction.EndDateTime#%'",
"[DATE_TIME] >='%#Transaction.StartDateTime#%' AND
[DATE_TIME]<='%#Transaction.EndDateTime#%'")
On execution, I get the foll error:-
3:1 - type check error: the left hand side >>DATE_TIME.< (TIMESTAMP) and the right hand side >>'%2015-04-21T09:58:14%'<< (CHAR) of a comparison operator are not comparable
Startdatetime and ENDdatetime are both transaction variables of datetime type.
Is there a syntax issue wrt to above(% wildcard or etc.)? How can I handle such in MDOs?
Thanks
Rajeev
Yah I know.
Please note you need to define respective Params and paramtypes as well when you mark UseTypedParams and use the same in filter condition. Simply, setting UseTypedParams would obviously not work. PFB the screeshot:
When I say like other QTs, I meant the general mapping and all works the same way.
You cannot pass the transaction properties directly when you are using typed params. This has to go via params only.
Thanks,
Swaroop
Hi Rajeev,
This comes when the query does not find any data related to the filter applied. This means, syntactically the query is good to go now.
For your case, make sure you pass date in 'mm/dd/YYYY hh:MM:ss' format. MDO doesn't compare xml date format. XML date is the reason for such error.
Best Regards,
Swaroop
Hi Rajeev,
I suppose your query has been solved. Kindly close the thread by marking this as answered.
Thanks,
Swaroop
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
12 | |
6 | |
3 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.