Count(1) returns null in group by
hi gems..good afternoon..
I read that the COUNT() function always returns 0 (zero) if there is no matching rows in the table.
The following code returns the 0 as expected:
SELECT COUNT(1) FROM book_table
WHERE client_id = 10009
AND book_id = 5465465
AND book_sub_id = 'gfdf'
AND amount = 78686But when I used the GROUP BY clause with the query, then it returned nothing:
SELECT COUNT(1) FROM book_table
WHERE client_id = 10009
AND book_id = 5465465
AND book_sub_id = 'gfdf'
AND amount = 78686
group by client_id,book_id,book_sub_id,amountWhy this is happening..please suggest...
gogol wrote:
But Ranit...
Again I am thinking...the COUNT() is an aggregate function. Now a function should return something(as per my plsql knowledge) and in this case the return datatype is integer. So why isnt it returning zero..Don't think like that sandy.
The Group By is actually done on an empty result set, so the result is neither 0 nor NULL
It is an empty result set.
Check this -- http://stackoverflow.com/questions/2552086/does-count-always-return-a-result
>
The "return value of the 'count' function" is ALWAYS a non-null integer, without exception. By mentioning "group by", you're referencing the containing query and changing the subject of "return value" from "count function" to "query's result set". A non-grouped count query produces a result set of a single record containing the return value of count. Alternatively, a grouped count query produces a result set where each record contains a count value. In that case, if there are no groups for count to run on, count is never run and the "query return value" is an empty set.
>
Hope this Helps.
Ranit B.
Edited by: ranit B on Nov 23, 2012 5:25 PM
Similar Messages
-
Select query having count function is returning null
Hi Everyone,
Please see the query and help me to get this solved.
DB version
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bi
PL/SQL Release 10.2.0.1.0 - Production
"CORE 10.2.0.1.0 Production"
TNS for Linux: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - ProductionQUERY
SELECT COUNT(*) as V_COUNT
FROM LAB_ORDER_TMPLT_TEST
WHERE TEST_ID IN
(SELECT WEST_TEST_ID
FROM TEST_CODE_CONVERSION TCC
WHERE TCC.EAST_TEST_ID = 2769)
GROUP BY LAB_ORDER_TMPLT_ID
HAVING COUNT(*) > 1;
It's returning null. Is there any way I can get the value as zero instead of null? Please help.Regards,
BS2012.Hi,
BS2012 wrote:
Hi Everyone,
Please see the query and help me to get this solved.
DB version
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bi
PL/SQL Release 10.2.0.1.0 - Production
"CORE 10.2.0.1.0 Production"
TNS for Linux: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - ProductionQUERY
SELECT COUNT(*) as V_COUNT
FROM LAB_ORDER_TMPLT_TEST
WHERE TEST_ID IN
(SELECT WEST_TEST_ID
FROM TEST_CODE_CONVERSION TCC
WHERE TCC.EAST_TEST_ID = 2769)
GROUP BY LAB_ORDER_TMPLT_ID
HAVING COUNT(*) > 1;
It's returning null.
Really? COUNT never returns NULL; it always returns 0 or a positive integer.
Do you mean the query results in "no rows selected"?
Is there any way I can get the value as zero instead of null? Please help.Do you want a query that will produce the same output as the query above, but will produce a single row containing 0 when the query above does not produce anything? That sounds like a job for an outer join:
WITH original_query AS
SELECT COUNT(*) AS v_count
FROM lab_order_tmplt_test
WHERE test_id IN
( SELECT west_test_id
FROM test_code_conversion tcc
WHERE tcc.east_test_id = 2769
GROUP BY lab_order_tmplt_id
SELECT NVL (o.v_count, 0) AS v_count
FROM dual
LEFT OUTER JOIN original_query o ON o.v_count > 0
;If you'd care to post CREATE TABLE and INSERT statements for the sample data, then I could test this. -
What's the meaning of "SID to Group returns null"
hi, I configure a ATN in WLS, and the ATN log shows:
<2005-10-2 ????01??28??05?? CST> <Debug> <SecurityDebug> <000000>
<returnConnection conn:LDAPConnection {ldap://localhost:389 ldapVersion:3
bindDN:"CN=weblogic,CN=Users,DC=mydavid,DC=org"}>
<2005-10-2 ????01??28??05?? CST> <Debug> <SecurityDebug> <000000> <LDAP Atn
Authenticated User weblogic>
<2005-10-2 ????01??28??05?? CST> <Debug> <SecurityDebug> <000000>
<oneShotGroupMembershipLookup called for weblogic>
<2005-10-2 ????01??28??05?? CST> <Debug> <SecurityDebug> <000000>
<activeDirectoryLookupTokenGroups called for weblogic>
<2005-10-2 ????01??28??05?? CST> <Debug> <SecurityDebug> <000000>
<getConnection return conn:LDAPConnection {ldap://localhost:389
ldapVersion:3 bindDN:"CN=weblogic,CN=Users,DC=mydavid,DC=org"}>
<2005-10-2 ????01??28??05?? CST> <Debug> <SecurityDebug> <000000>
<getDNForUser search("cn=Users,dc=mydavid,dc=org",
"(&(cn=weblogic)(objectclass=user))", base DN & below)>
<2005-10-2 ????01??28??05?? CST> <Debug> <SecurityDebug> <000000> <DN for
user weblogic: CN=weblogic,CN=Users,DC=mydavid,DC=org>
<2005-10-2 ????01??28??05?? CST> <Debug> <SecurityDebug> <000000> <No
groupname found for SID \01\02\00\00\00\00\00\05\20\00\00\00\21\02\00\00>
<2005-10-2 ????01??28??05?? CST> <Debug> <SecurityDebug> <000000> <SID to
Group returns null>
<2005-10-2 ????01??28??05?? CST> <Debug> <SecurityDebug> <000000> <No
groupname found for SID \01\02\00\00\00\00\00\05\20\00\00\00\20\02\00\00>
<2005-10-2 ????01??28??05?? CST> <Debug> <SecurityDebug> <000000> <SID to
Group returns null>
<2005-10-2 ????01??28??05?? CST> <Debug> <SecurityDebug> <000000> <Group
mapping found is Domain Users>
<2005-10-2 ????01??28??05?? CST> <Debug> <SecurityDebug> <000000> <SID to
Group returns Domain Users>
<2005-10-2 ????01??28??05?? CST> <Debug> <SecurityDebug> <000000>
<returnConnection conn:LDAPConnection {ldap://localhost:389 ldapVersion:3
bindDN:"CN=weblogic,CN=Users,DC=mydavid,DC=org"}>
<2005-10-2 ????01??28??05?? CST> <Debug> <SecurityDebug> <000000>
<oneShotGroupMembershipLookup returns with 1 groups>
<2005-10-2 ????01??28??05?? CST> <Debug> <SecurityDebug> <000000> <login
succeeded for username weblogic>
what's the meaning of "SID to Group returns null"?
\01\02\00\00\00\00\00\05\20\00\00\00\21\02\00\00 resprent for what?
Any one could tell me?
thanks.
david.turingHi
In AR, you will give cash discount to customer and not the other way round as you mentioned.
For eg if AR value is 100 and customer pays you 90, there is a difference of 10. Assume you have cash discount % of say 6%, you expect the customer to pay 94 (100- 6% of 100) and not 90. There is still a gap of 4. This can be added to cash discount account if you enter 4 in this field. Hence the A/c entry will be:
Dr Bank 90
Dr cash discount (expense/loss) 10
Cr Customer 100
However this field is interlinked with some other fields like "Cash discount per line item", etc
Jayaram -
MDX Query using BottomCount to limit Median calculation returns null
I'm building a new cube that includes some person age values that aren't useful when summed, but are
useful when the median is determined. The measure group that contains the measure for the age has a 1-1 relationship with a dimension in the cube because both use the same table as the source. This is important because I use the key attribute of the dimension
as the set expression in the Median function to prevent any summation before the median is found. Here is the code for the original median calculation:
MEMBER Measures.[Median Age] AS
MEDIAN(
[Placement Dimension].[Id Removal Episode Fact].Members,
[Measures].[Age At Removal Months]
This median naturally represents the half-way point in the series of values. My analysts have also requested
median-type values at the quarter and three-quarter points in the same series. I've been able to accomplish this for the three-quarter point by nesting the TopCount function in the set expression of the Median function to limit the set to the last half of
the records and then find the median point like this:
MEMBER Measures.[75th Percentile] AS
MEDIAN(
TOPCOUNT(
[Placement Dimension].[Id Removal Episode Fact].MEMBERS
,Measures.[Episode Count] / 2
,Measures.[Age At Removal Months]
,Measures.[Age At Removal Months]
However, my attempt to use the BottomCount function in the same way as TopCount to find the quarter point
in the whole data set by limiting the calculation's set to the first half of the data always returns null. Here is how I've formed the code:
MEMBER Measures.[25th Percentile] AS
MEDIAN(
BOTTOMCOUNT(
[Placement Dimension].[Id Removal Episode Fact].MEMBERS
,Measures.[Episode Count] / 2
,Measures.[Age At Removal Months]
,Measures.[Age At Removal Months]
And here is the query that returns the values:
SELECT
Measures.[Episode Count]
,Measures.[Median Age]
,Measures.[25th Percentile]
,Measures.[75th Percentile]
} ON 0
,[Date Begin].[Calendar Hierarchy].Year.&[2011]:[Date Begin].[Calendar Hierarchy].Year.&[2014] ON 1
FROM [POC Cube]
WHERE
[Age at Removal Mos].[Age in Years List].[Age Year].&[0]:[Age at Removal Mos].[Age in Years List].[Age Year].&[5]
I don't know why the end result is always null. I don't have any null values in the data for this measure, and I know what values I should be seeing because I've found the median records manually in results from a SQL Server query. I've tried using TopCount
and multiplying Measures.[Age At Removal Months] in the TopCount function by -1 to workaround the descending sort, but I still get nulls. I've also tried separating these queries out so the quarter point and three-quarter point calculations aren't run together,
but I still get nulls for the quarter point calculation.
I'm open to any help fixing this situation by modifying my current code or by using alternate methods, but the end result has to be dynamic enough to be used as a calculation in the cube. Thanks!The links might helps.
http://technet.microsoft.com/en-us/library/ms144864.aspx
http://www.mssqltips.com/sqlservertip/3034/sql-server-analysis-services-ssas-2012-top-and-bottom-functions/
http://www.sqlservercentral.com/blogs/bradleyschacht/2012/03/12/mdx-functions-bottomcount/ -
Problem with accessing dynamically created movie clips, returns null...
Hopefully this is a stupid question with an easy answer, if my code is straight forward enough.
I am using this snippet of code to create menu items, and then use the jCount variable below to give the clips an index number, like so (which seems to be working just fine):
for(var j:Number=0;j<xmlSubMenuLength;j++){
var mcSubMenuItem:mcSubMenu=new mcSubMenu();
addChild(mcSubMenuItem);
jCount++;
mcSubMenuItem.name = "mcSubMenuItem" + jCount;
//traces out names correctly
trace ("---------------------------------jCount NAME = "+ mcSubMenuItem.name);
mcSubMenuItem.x=mcMenuHolder.x+20;
mcSubMenuItem.y =mcMenuHolder.y;
mcSubMenuItem.y+= nextBtnY;
nextBtnY+=subtopicSpace;
global_subi.text = String(jCount); //i see the proper count of 10 in the text field
However, when I try to access the clips using this snippet:
for(var j:Number=0;j<Number(global_subi.text);j++)//
trace("GLOBAL SUBI = "+ String(global_subi.text)); //traces out 10, which it should
var scSubMenuItem:String = "mcSubMenuItem" + j;
var scSubContent:Object = this.getChildByName(scSubMenuItem);
trace(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>scSubContent:Object = "+ scSubContent); //returns null!
My last trace statement returns null. Can anyone see my error, or explain why I can't access my clips after they have been created?
Thank you muchly,
~ChiplehHi kglad,
Thanks for the response.
"it's not clear from the shown code that jCount is initialized." - I've posted the relevant code below, which shows that I'm initializing jCount.
"and it's not clear why you don't use j instead of jCount in that for-loop" - j is used as loop for creating the subtopic movie clips within the i for-loop. So, for each topic in i for-loop, create a group of suptopics using the j for-loop. The j for-loop re-initiates j every time the length of the subtopics is reached(if that makes any sense) - i.e. topic1>subtopic 1,2,3,4 : topic2>subtopic>1,2 : topic3>subtopic1,2,3,4
jCount is used to keep a running count of the total number of subtopcs created - i.e. per the example above, jCount will display 10.
var topicSpace:uint=button_mc.height;
var subtopicSpace:uint = button_mc.height;
var nextBtnY:uint = 0;//whatever;
var jCount:Number = 0;
function createXMLMenu(menuLength:Number,itemName:XMLList):void{
var navItemText:XMLList = itemName;
for(var i:Number=0;i<menuLength;i++)
var mcMenuItem:mcMenu=new mcMenu();
addChild(mcMenuItem);
mcMenuItem.btnTxt.htmlText = i+1 +". " +navItemText[i];
mcMenuItem.ivar = i;
mcMenuItem.name = "mcMenuItem" + i;
mcMenuItem.x=mcMenuHolder.x;
mcMenuItem.y =mcMenuHolder.y;
//kglad's addition
mcMenuItem.y+= nextBtnY;
nextBtnY+=topicSpace;
var subVar:Number = i;//mcMenuItem.ivar
//Submenu content
var xmlSubMenuLength:Number = xml.sim.bodyText.page[i].subpage.length()
var menuItemAttachment:MovieClip = MovieClip(mcMenuItem);
for(var j:Number=0;j<xmlSubMenuLength;j++)
var xmlSubPageNumber:XMLList = xml.sim.bodyText.page[subVar].subpage;
var subNavLinkNumber:Number = xmlSubPageNumber[j];
var subTitleText:String = xml.sim.bodyText.page[subVar].subpage.subNavItem[j];
var mcSubMenuItem:mcSubMenu=new mcSubMenu();
trace("mcSubMenuItem.ivar = "+ j+1);
var mc2Attach2:MovieClip = MovieClip(menuItemAttachment);
mcSubMenuItem.btnTxt.htmlText = j+1 +". " +subTitleText;
mcSubMenuItem.ivar = Number(subVar);
mcSubMenuItem.jvar = Number(j);
addChild(mcSubMenuItem);
jCount++;
mcSubMenuItem.name = "mcSubMenuItem" + jCount;
trace ("---------------------------------jCount NAME = "+ mcSubMenuItem.name);
mcSubMenuItem.x=mcMenuHolder.x+20;
mcSubMenuItem.y =mcMenuHolder.y;
//kglad's addition
mcSubMenuItem.y+= nextBtnY;
nextBtnY+=subtopicSpace;
global_subi.text = String(jCount);
mcSubMenuItem.lExtend.visible = false;
global_i.text = String(i);
Then I try to access the clips like so:
-The first for-loop access the topic movie clips, no problem, and traces out scContent correctly.
-The second for-loop traces out null everytime, when I would expect it to be tracing out the names of the subtopic movie clips.
function accessClips(){
//This will access the topic movie clips
for(var i:Number=0;i<Number(global_i.text);i++)
var scMenuItem:String = "mcMenuItem" + i;
var scContent:Object = this.getChildByName(scMenuItem);
trace(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>scContent:Object = "+ scContent);
//This is supposed to access the subtopic movie clips
for(var j:Number=0;j<Number(global_subi.text);j++)//
var scSubMenuItem:String = "mcSubMenuItem" + j;
var scSubContent:Object = this.getChildByName(scSubMenuItem);
trace(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>scSubContent:Object = "+ scSubContent);
Hope this makes sense, Chipleh confused. If the code is not clear enough, let me know and I'll try to further clarify.
Thanks again,
~Chipleh -
Output parameters always return null when ExecuteNonQuery - No RefCursor
I am trying to call a procedure through ODP that passes in one input parameter and returns two (non-RefCursor) VARCHAR2 output parameters. I am calling the procedure using ExecuteNonQuery(); however, my parameters always return null. When I run the procedure outside of ODP, such as with SQLPlus or SQL Navigator, the output parameters are populated correctly. For some reason, there appears to be a disconnect inside of ODP. Is there a way to resolve this?
Anyone have this problem?
Here is the basic code:
===========================================================
// External call of the class below
DBNonCursorParameterTest Tester = new DBNonCursorParameterTest();
===========================================================
// The class and constructor that calls the procedure and prints the results.
public class DBNonCursorParameterTest
public DBNonCursorParameterTest()
// The test procedure I used is a procedure that takes a recordID (Int32) and then returns a
// general Name (Varchar2) and a Legal Name (Varchar2) from one table with those three fields.
string strProcName = "MyTestProc;
OracleConnection conn = new OracleConnection(DBConnection.ConnectionString);
OracleCommand cmd = new OracleCommand(strProcName,conn);
cmd.CommandType = CommandType.StoredProcedure;
// Create the input parameter and the output cursor parameter to retrieve data; assign a value to the input parameter;
// then create the parameter collection and add the parameters.
OracleParameter pBPID = new OracleParameter("p_bpid", OracleDbType.Int32, ParameterDirection.Input);
OracleParameter pBPName = new OracleParameter("p_Name", OracleDbType.Varchar2, ParameterDirection.Output);
OracleParameter pBPLegalName = new OracleParameter("p_LegalName", OracleDbType.Varchar2, ParameterDirection.Output);
pBPID.Value = 1;
// Open connection and run stored procedure.
try
conn.Open();
cmd.Parameters.Add(pBPID);
cmd.Parameters.Add(pBPName);
cmd.Parameters.Add(pBPLegalName);
cmd.ExecuteNonQuery();
Console.Write("\n" + cmd.CommandText + "\n\n");
//for (int i = 0; i < cmd.Parameters.Count; i++)
// Console.WriteLine("Parameter: " + cmd.Parameters.ParameterName + " Direction = " + cmd.Parameters[i].Direction.ToString());
// Console.WriteLine("Parameter: " + cmd.Parameters[i].ParameterName + " Status = " + cmd.Parameters[i].Status.ToString());
// Console.WriteLine("Parameter: " + cmd.Parameters[i].ParameterName + " Value = " + cmd.Parameters[i].Value.ToString() + "\n");
foreach (OracleParameter orap in cmd.Parameters)
Console.WriteLine("Parameter: " + orap.ParameterName + " Direction = " + orap.Direction.ToString() + " Value = " + orap.Value.ToString());
Console.WriteLine("Parameter: " + orap.ParameterName + " Status = " + orap.Status.ToString());
Console.WriteLine("Parameter: " + orap.ParameterName + " Value = " + orap.Value.ToString() + "\n");
// End Test code.
catch (Exception ex)
throw new Exception("ExecuteQuery() failed: " + ex.Message);
finally
this.Close();
public void Close()
if (conn.State != ConnectionState.Closed)
conn.Close();
=========================================================
Other things to note:
I have no problems with returning RefCursors; they work fine. I just don't want to use RefCursors when they are not efficient, and I want to have the ability to return output parameters when I only want to return single values and/or a value from an insert/update/delete.
Thanks for any help you can provide.Hello,
Here's a short test using multiple out parameters and a stored procedure. Does this work as expected in your environment?
Database:
/* simple procedure to return multiple out parameters */
create or replace procedure out_test (p_text in varchar2,
p_upper out varchar2,
p_initcap out varchar2)
as
begin
select upper(p_text) into p_upper from dual;
select initcap(p_text) into p_initcap from dual;
end;
/C# source:
using System;
using System.Data;
using Oracle.DataAccess.Client;
using Oracle.DataAccess.Types;
namespace Miscellaneous
class Program
static void Main(string[] args)
// change connection string as appropriate
const string constr = "User Id=orademo; " +
"Password=oracle; " +
"Data Source=orademo; " +
"Enlist=false; " +
"Pooling=false";
// the stored procedure to execute
const string sql = "out_test";
// simple input parameter for the stored procedure
string text = "hello!";
// create and open connection
OracleConnection con = new OracleConnection(constr);
con.Open();
// create and setup connection object
OracleCommand cmd = con.CreateCommand();
cmd.CommandText = sql;
cmd.CommandType = CommandType.StoredProcedure;
// the input paramater
OracleParameter p_text = new OracleParameter("p_text",
OracleDbType.Varchar2,
text.Length,
text,
ParameterDirection.Input);
// first output parameter
OracleParameter p_upper = new OracleParameter("p_upper",
OracleDbType.Varchar2,
text.Length,
null,
ParameterDirection.Output);
// second output parameter
OracleParameter p_initcap = new OracleParameter("p_initcap",
OracleDbType.Varchar2,
text.Length,
null,
ParameterDirection.Output);
// add parameters to collection
cmd.Parameters.Add(p_text);
cmd.Parameters.Add(p_upper);
cmd.Parameters.Add(p_initcap);
// execute the stored procedure
cmd.ExecuteNonQuery();
// write results to console
Console.WriteLine(" p_text = {0}", text);
Console.WriteLine(" p_upper = {0}", p_upper.Value.ToString());
Console.WriteLine("p_initcap = {0}", p_initcap.Value.ToString());
Console.WriteLine();
// keep console from closing when run in debug mode from IDE
Console.WriteLine("ENTER to continue...");
Console.ReadLine();
}Output:
p_text = hello!
p_upper = HELLO!
p_initcap = Hello!
ENTER to continue...- Mark -
Distinct Count of Non-null Values
I have a table that has one column for providerID and then a providerID in each of several columns if the provider is under a particular type of contract.
I need a distict count of each provider under each type of contract for every county in the US.
distinct count is almost always one more than the actual distict count because most counties have at least one provider that does not have a particular contract and the distict count counts the null value as a distict value.
I know I can alter the fields to have a zero for nulls, ask for a minimum count and then subtract 1 from the distict count if the minimum is zero, but I hope there is an easier way to figure distict counts of non-null values.
any suggestions?
Thanks,
JenniferHello,
*I need a distict count of each provider under each type of contract for every county in the US*
To the above requiremetn,
I will suggest the following approach.
Use group expert formula for country, contract and provider.
Now you will have the hierarchy to which level you want to apply distinct count. You can do it as suggested by ken hamady.
Regards
Usama -
GetUsageData is always returning Null
Let me first start out by stating that I know there are many questions on this issue, and I have read them all. However, none of the suggestions that I have read have seemed to help my situation. Therefore, I figure I would supply my code with the hopes
that someone can solve the issue that is mentioned in the title. Let me first supply a little bit of background.
My goal in this code is to determine what are the most visited sites in our SharePoint 2010 farm. To do this, I figured I would cycle through all of the webs in the farm, and then obtain the amount of page views within each site using the GetUsageData function.
Just to test if the GetUsageData was supplying the correct data, I coded the web part in such a way where if GetUsageData returned "Null", it would print it for every site, and "Not Null" if otherwise. In every case I have tested this web part, it has always
returned Null for evey site it has checked.
I am fairly new to programming web parts in C#, so a lot of this code is derived from what I have read when researching the subject. If anyone can assist me to see where I could fix my issue, I would greatly appreciate it.
Thank you.
Below is my Code:
using System;
using System.Data;
using System.Collections;
using System.ComponentModel;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Administration;
using Microsoft.SharePoint.WebControls;
//This code has been derived from the following link: http://blog.rafelo.com/2008/07/22/iterating-through-sharepoint-web-applications-site-collections-and-sites-webs/
namespace WebAnalyticsTest.Test
[ToolboxItemAttribute(false)]
public class Test : WebPart
//For testing purposes. More is explained further in the code.
int test;
ArrayList totalHitsArray = new ArrayList();
int totalHits;
DataGrid grid = null;
public void BeginProcess()
// Get references to the farm and farm WebService objects
// the SPWebService object contains the SPWebApplications
SPFarm thisFarm = SPFarm.Local;
SPWebService service = thisFarm.Services.GetValue<SPWebService>("");
foreach (SPWebApplication webApp in service.WebApplications)
//Execute any logic you need to against the web application
//Iterate through each site collection
foreach (SPSite siteCollection in webApp.Sites)
//do not let SharePoint handle the access denied
//exceptions. If one occurs you will be redirected
//in the middle of the process. Handle the AccessDenied
//exception yourself in a try-catch block
siteCollection.CatchAccessDeniedException = false;
try
//Execute any logic you need to against the site collection
//Call the recursive method to get all of the sites(webs)
GetWebs(siteCollection.AllWebs);
catch (Exception webE)
//You should log the error for reference
//reset the CatchAccessDeniedException property of the site
//collection to true
siteCollection.CatchAccessDeniedException = true;
public void GetWebs(SPWebCollection allWebs)
//iterate through each site(web)
foreach (SPWeb web in allWebs)
if(web.Exists)
//For every site the program finds, the count will increase by one. If this code is executed by a user who does not have
//full control, then the count will be inaccurate as it will only return the number of sites the user can access.
test += 1;
DataTable table = web.GetUsageData(Microsoft.SharePoint.Administration.SPUsageReportType.browser, Microsoft.SharePoint.Administration.SPUsagePeriodType.lastMonth);
if (table == null)
HttpContext.Current.Response.Write("Null");
else
HttpContext.Current.Response.Write("Not Null");
protected override void CreateChildControls()
BeginProcess();Hi, Shiladitya.
Sorry I haven't replied until now. I'll paste the current code I am using, but my solution is not yet complete. What it does as of right now is it creates a data table with all of the webs located in your farm, as well as the total amount of page views for
each web. What I noticed though is that when I compare these stats with the web analytics for the specific web, they don't match. I put the project on hold for this reason, and I might start it back up again soon. Feel free to use the code, and perhaps you
maybe can shed some light on my issue.
using System;
using System.Data;
using System.Collections;
using System.ComponentModel;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Administration;
using Microsoft.SharePoint.WebControls;
//This code has been derived from the following link: http://blog.rafelo.com/2008/07/22/iterating-through-sharepoint-web-applications-site-collections-and-sites-webs/
namespace WebAnalyticsTest.Test
[ToolboxItemAttribute(false)]
public class Test : WebPart
//For the total amount of hits for a single web
int totalHits;
//The final data table that will be added to.
DataTable final = new DataTable();
//Size of the data table
int finalSize = 0;
//The grid that will be displayed
DataGrid grid = new DataGrid();
public void BeginProcess()
//To allow users with lower permissions to view the proper content, the code must be used with RunWithElevatedPrivileges.
SPSecurity.RunWithElevatedPrivileges(delegate()
// Get references to the farm and farm WebService objects
// the SPWebService object contains the SPWebApplications
SPFarm thisFarm = SPFarm.Local;
SPWebService service = thisFarm.Services.GetValue<SPWebService>("");
foreach (SPWebApplication webApp in service.WebApplications)
//Execute any logic you need to against the web application
//Iterate through each site collection
foreach (SPSite siteCollection in webApp.Sites)
//do not let SharePoint handle the access denied
//exceptions. If one occurs you will be redirected
//in the middle of the process. Handle the AccessDenied
//exception yourself in a try-catch block
siteCollection.CatchAccessDeniedException = false;
try
//Execute any logic you need to against the site collection
//Call the recursive method to get all of the sites(webs)
GetWebs(siteCollection.AllWebs);
catch (Exception webE)
//Place any error logic here
//reset the CatchAccessDeniedException property of the site
//collection to true
siteCollection.CatchAccessDeniedException = true;
public void GetWebs(SPWebCollection allWebs)
//iterate through each site(web)
foreach (SPWeb web in allWebs)
if (web.Exists)
DataTable table = web.GetUsageData(SPUsageReportType.url, SPUsagePeriodType.lastMonth);
if (table != null)
//Determines the total amount of hits for a single web
foreach (DataRow row in table.Rows)
int num = System.Convert.ToInt32(row["Total Hits"]);
totalHits = totalHits + num;
//Temporarily stores the total hits with the associated web.
DataTable temp = new DataTable();
temp.Columns.Add("Site", typeof(string));
temp.Columns.Add("Total Views", typeof(int));
temp.Rows.Add(web.Title, totalHits);
//Merges the data table "temp" to the data table "final"
final.Merge(temp);
//Data table size increases by one.
finalSize += 1;
//Resets the total hit counter
totalHits = 0;
protected override void CreateChildControls()
BeginProcess();
//Sorts the data table bases on the total hits
final.DefaultView.Sort = "Total Views DESC";
//The total amount of pages to show is 10. Therefore, only execute this If statement if the final's size > 10.
if (finalSize > 10)
//Data table of the top ten most viewed pages. This data table will be used in the data grid "grid"
DataTable topTen = final.Clone();
for (int i = 0; i < 10; i++)
topTen.ImportRow(final.Rows[i]);
grid.DataSource = topTen;
else
grid.DataSource = final;
grid.DataBind();
this.Controls.Add(grid);
ListBox list = new ListBox(); -
Getnode returned null for uri error for caldav server
Hello,
I am trying to install the Oracle UCS ( SUN 7 update 2 ) server.
https://wikis.oracle.com/display/CommSuite7U2/Communications+Suite+on+a+Single+Host+%28Linux%29#CommunicationsSuiteonaSingleHost%28Linux%29-InstallingtheExample
So far, I have successfully:
Checked the installation requirements
Installed Communications Suite 7 Update 2 Software
Installed and Configured the Directory Server
Prepared the Directory under ( Configuring Communications Suite Components )
Configured Delegated Administrator and Communications CLI
Configured Messaging Server
Configured MYSQL Server
Configured Calendar Server
I have just installed a caldav server. I checked that it was enabled by running:
# asadmin list-components -p <admin-port> --type=web
davserver <web-module>
Command list-components executed successfully.
# asadmin show-component-status -p <admin-port> davserver
Status of davserver is enabled.
Command show-component-status executed successfully.
that was from this page:
https://wikis.oracle.com/display/CommSuite7RR92909/Calendar+Server+7+Troubleshooting
In Firefox, I try to hit the suggested pages under "Testing Calendar accounts". However, this errors out every time for me.
http://domain.com/davserver/dav/h/myDomain.com/myusername/calendar
wheremyDdomain.com is my actual domain that I will not list here
and myUsername is my actual username which I will not list here
( I edited both of these in the logs below )
I checked my log in /var/opt/sun/comms/davserver/logs:
INFO [2012-02-11T11:46:02.729-0500] <...DavServer.<init>> Server Startup succeeded
INFO [2012-02-11T11:46:02.730-0500] <...DavServer.loadBackend> Loading backend defaultbackend with backendid defaultbackend
INFO [2012-02-11T11:46:02.730-0500] <...DavServer.loadBackend> JDBC JNDI Name = jdbc/defaultbackend
INFO [2012-02-11T11:46:09.033-0500] <...DavServer.loadBackend> Loading backend ischedulebackend with backendid ischedulebackend
INFO [2012-02-11T11:46:09.033-0500] <...DavServer.loadBackend> JDBC JNDI Name = jdbc/ischedulebackend
INFO [2012-02-11T11:46:09.427-0500] <...DavServer.loadBackends> iSchedule enabled
INFO [2012-02-11T11:46:09.439-0500] <...DavServer.loadBackends> modified ischedule collection at /ischedule/
INFO [2012-02-11T13:33:18.967-0500] <...URIInfoManagerImpl.getEntryFromSearchFilter> found 0 corresponding to: (uid=caldav)
INFO [2012-02-11T13:33:59.844-0500] <...URIInfoManagerImpl.getEntryFromSearchFilter> found 0 corresponding to: (uid=caldav)
FINE [2012-02-11T13:42:39.157-0500] <...DavServerServlet.service> [REQ] GET /davserver/browse/h/myDomainName/myUserName/calendar 127.0.0.1 myDomainName
FINE [2012-02-11T13:42:39.808-0500] <...LDAPSingleHostPool.getConnection> got connection from getConnection() for pool Pool number:0. Host=myDomainName
FINE [2012-02-11T13:42:41.441-0500] <...LDAPSingleHostPool.getConnection> got connection from getConnection() for pool Pool number:0. Host=myDomainName
FINE [2012-02-11T13:42:41.460-0500] <...LoginModuleHelper.checkIfUserInAdminGroup> user: admin; isMemberOf = cn=Service Administrators, ou=Groups, o=isp
FINE [2012-02-11T13:42:41.684-0500] <...DavBrowserServlet.service> Got a non standard condition: getNode returned null for uri /davserver/browse/h/myDomainName/myUserName/calendar
FINE [2012-02-11T13:42:41.684-0500] <...DavServerServlet.service> [RES] [404] Command execution time: 2.527 secs
I can hit this page from the browser:
http://myDomainName:4848
From my understanding, that is the admin port. That brings up the GlassFish server admin page.
I do not remember creating a calendar account anywhere is my first thought. I followed the example deployment step by step so far and nowhere does it have me create a calendar user account. So, maybe there is no account at this point?
So, my first question would be:
How can I verify that I have a calendar account to begin with? ( or is this what I am doing by trying to log into the sites suggested under 'Test Calendar Accounts').
My next question would be:
What does this error mean: "getnode returned null for uri error for caldav server"?
Spin off question from that:
What should I do to fix that error?
Thanks in advance!I did not put a slash at the end of the uris I was testing
http://myDomain.com:80/davserver/browse/h/myDomain/myUserName/calendar
http://myDomain.com:80/davserver/dav/h/myDomain/myUserName/calendar
Once I put the slash at the end of the uri, the configuration page appeared and the error was not displayed about getNode anymore:
http://myDomain.com:80/davserver/browse/h/myDomain/myUserName/calendar/
http://myDomain.com:80/davserver/dav/h/myDomain/myUserName/calendar/ -
OHW in ADF ( Exception - 'helpProvider' returned null )
Hi,
I am new to OHW, tried using it in ADF and got stuck with below exception.
Kindly suggest to resolve.
i added following to adf-config.xml ( adf/META-INF/adf-config.xml )
<help-provider>
<help-provider-class>
oracle.help.web.rich.helpProvider.OHWHelpProvider
</help-provider-class>
<property>
<property-name>ohwConfigFileURL</property-name>
<value>/helpsets/ohwconfig.xml</value>
</property>
<!--property>
<property-name>group</property-name>
<value>null</value>
</property-->
<property>
<property-name>baseURI</property-name>
<value>http://localhost:8888/ohwdemo/help/</value>
</property>
</help-provider>
copied helpsets folder to .war
and added <af:panelLabelAndMessage helpTopicId="concise" label="Test"> to JSF page.
2008-06-06 16:15:05.735 No help provider found for helpTopicId=concise.
2008-06-06 16:15:05.735 No help provider found for helpTopicId=concise.
2008-06-06 16:15:05.782 irm_rights: Servlet errorjavax.el.PropertyNotFoundException: Target Unreachable, 'helpProvider' returned null
at com.sun.el.parser.AstValue.getTarget(AstValue.java:87)
at com.sun.el.parser.AstValue.getType(AstValue.java:55)
at com.sun.el.ValueExpressionImpl.getType(ValueExpressionImpl.java:180)
at oracle.adfinternal.view.faces.renderkit.rich.ValueRenderer.getDefaultConverter(ValueRenderer.java:172)
at oracle.adfinternal.view.faces.renderkit.rich.ValueRenderer.addClientConverterRenderScript(ValueRenderer.java:216)
at oracle.adfinternal.view.faces.renderkit.rich.OutputLabelRenderer.encodeAll(OutputLabelRenderer.java:207)
at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:969)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:223)
at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:750)
............Are you still running into this issue?
Please note that we recently released a new version of Oracle Help, version 5.0, available here:
http://www.oracle.com/technology/tech/java/help/index.html
Regards, Maria -
Does readLine return null at end of file?
My program is reading lines from a file in groups of 5. I want it to stop reading when it has reached the end of the file. Does readLine return null when there are no more lines or is there another way to end a loop like this?
Thanks!
try {
String a, b, c, d, e;
a = BR.readLine();
b = BR.readLine();
c = BR.readLine();
d = BR.readLine();
e = BR.readLine();
while (a != null){
a = BR.readLine();
b = BR.readLine();
c = BR.readLine();
d = BR.readLine();
e = BR.readLine();
}readLine returns null at end of file. I actually use the following to end my loop...maybe this would help you.
FileReader file = new FileReader("bkupcandilist.bin");
BufferedReader buff = new BufferedReader(file);
boolean eof = false;
while(!eof) { //retrieve all candidate names
scandi = buff.readLine();
if(scandi == null) {
eof = true;
} else {
atally = new String[2];
atally[0] = scandi;
atally[1] = "0";
listtally.add(atally);
buff.close(); -
Any way to return NULL using MIN
I need to return NULL when select the MIN of a column that has vales and NULLs.
Any ideas?Try the syntax shown in RESULT_2 below.
set null "(null)"
with t as
select 'a' as group_key, null as val from dual union all
select 'b' as group_key, null as val from dual union all
select 'b' as group_key, 1 as val from dual union all
select 'c' as group_key, 3 as val from dual
select
group_key ,
min( val ) result_1 ,
min( val ) keep (dense_rank first order by val nulls first) result_2
from t
group by group_key ;
G RESULT_1 RESULT_2
a (null) (null)
b 1 (null)
c 3 3--
Joe Fuda
SQL Snippets -
EjbFindByPrimaryKey returns null
Hello,
We are writing an BMP in 6.1 SP 2. The ejbLoad perfectly loads the data.
From the Remote using the getPrimaryKey() to get the PrimaryKey. That key
is passed to the findByPrimaryKey(PK) call. But, it returns the following.
I have the db-is-shared to false in weblogic-ejb-jar.xml. It looks like it
is returning null and I don't understand why it is doing like this. Whether
it is because, it is not able to find the object through the
findByPrimaryKey or I am making any mistakes.
I even system.out.println inside the ejbFindByPrimaryKey and the key is not
null, it is having the value. Any help is greatly appreciated.
mcar.ejb.rbm.RBMCustomBean_ocyn82_Impl - ejbFindByPrimaryKey - 1
mcar.ejb.rbm.RBMCustomPK@10a07 - PFINA
mcar.ejb.rbm.RBMCustomBean_ocyn82_Impl - refresh - 1 : PFINA - false
mcar.ejb.rbm.RBMCustomBean_ocyn82_Impl - ejbFindByPrimaryKey - 2
mcar.ejb.rbm.RBMCustomPK@10a07 - PFINA
Did not find for the CUID another : PFINA
java.rmi.RemoteException: The findByPrimaryKey method from home:
mcar.ejb.rbm.RBMCustomHome was passed: null, but it returned null
mcar.ejb.rbm.RBMCustomBean_ocyn82_Impl - ejbFindByPrimaryKey - 2
mcar.ejb.rbm.RBMCustomPK@e5a5f - PFINA
Did not find for the CUID another : PFINA
java.rmi.RemoteException: The findByPrimaryKey method from home:
mcar.ejb.rbm.RBMCustomHome was passed: null, but it returned null
Start server side stack trace:
java.rmi.RemoteException: The findByPrimaryKey method from home:
mcar.ejb.rbm.RBMCustomHome was passed: null, but it returned null
at
weblogic.ejb20.manager.BaseEntityManager.findByPrimaryKey(BaseEntityManager.
java:443)
at
weblogic.ejb20.manager.BaseEntityManager.remoteFindByPrimaryKey(BaseEntityMa
nager.java:376)
at
weblogic.ejb20.internal.EntityEJBHome.findByPrimaryKey(EntityEJBHome.java:33
2)
at
mcar.ejb.rbm.RBMCustomBean_ocyn82_HomeImpl.findByPrimaryKey(RBMCustomBean_oc
yn82_HomeImpl.java:99)
at mcar.ejb.rbm.RBMCustomBean_ocyn82_HomeImpl_WLSkel.invoke(Unknown
Source)
at
weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:298)
at
weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef.java
:93)
at
weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:267)
at
weblogic.rmi.internal.BasicServerRef.dispatch(BasicServerRef.java:166)
at
weblogic.rmi.internal.ServerRequest.sendOneWayRaw(ServerRequest.java:92)
at
weblogic.rmi.internal.ServerRequest.sendReceive(ServerRequest.java:112)
at
weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java
:262)
at
weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java
:229)
at weblogic.rmi.internal.ProxyStub.invoke(ProxyStub.java:35)
at $Proxy80.findByPrimaryKey(Unknown Source)
at
jsp_servlet.__HMqwestagentform._jspService(__HMqwestagentform.java:173)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:265)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:304)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:200)
at
weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletCo
ntext.java:2495)
at
weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java
:2204)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
End server side stack trace
<<no stack trace available>>
JSP Exception : java.lang.NullPointerException
java.lang.NullPointerException
at
jsp_servlet.__HMqwestagentform._jspService(__HMqwestagentform.java:181)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:265)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:304)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:200)
at
weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletCo
ntext.java:2495)
at
weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java
:2204)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
Thanks,
GaneshSentence fragments.
Missing predicates.
It's a bit hard trying to understand your questions.
In BMP you write the ejbFindByPrimaryKey method. Your job in that method is
to verify that it exists in the DB and throw an ObjectNotFoundException if
not. You return the valid PK (the one passed in) if it does exist. So, what
exactly is returning null?
"Ganapathy Sankaran" <[email protected]> wrote in message
news:[email protected]...
Hello,
We are writing an BMP in 6.1 SP 2. The ejbLoad perfectly loads the data.
From the Remote using the getPrimaryKey() to get the PrimaryKey. That key
is passed to the findByPrimaryKey(PK) call. But, it returns thefollowing.
I have the db-is-shared to false in weblogic-ejb-jar.xml. It looks like it
is returning null and I don't understand why it is doing like this.Whether
it is because, it is not able to find the object through the
findByPrimaryKey or I am making any mistakes.
I even system.out.println inside the ejbFindByPrimaryKey and the key isnot
null, it is having the value. Any help is greatly appreciated.
mcar.ejb.rbm.RBMCustomBean_ocyn82_Impl - ejbFindByPrimaryKey - 1
mcar.ejb.rbm.RBMCustomPK@10a07 - PFINA
mcar.ejb.rbm.RBMCustomBean_ocyn82_Impl - refresh - 1 : PFINA - false
mcar.ejb.rbm.RBMCustomBean_ocyn82_Impl - ejbFindByPrimaryKey - 2
mcar.ejb.rbm.RBMCustomPK@10a07 - PFINA
Did not find for the CUID another : PFINA
java.rmi.RemoteException: The findByPrimaryKey method from home:
mcar.ejb.rbm.RBMCustomHome was passed: null, but it returned null
mcar.ejb.rbm.RBMCustomBean_ocyn82_Impl - ejbFindByPrimaryKey - 2
mcar.ejb.rbm.RBMCustomPK@e5a5f - PFINA
Did not find for the CUID another : PFINA
java.rmi.RemoteException: The findByPrimaryKey method from home:
mcar.ejb.rbm.RBMCustomHome was passed: null, but it returned null
Start server side stack trace:
java.rmi.RemoteException: The findByPrimaryKey method from home:
mcar.ejb.rbm.RBMCustomHome was passed: null, but it returned null
at
weblogic.ejb20.manager.BaseEntityManager.findByPrimaryKey(BaseEntityManager.
java:443)
at
weblogic.ejb20.manager.BaseEntityManager.remoteFindByPrimaryKey(BaseEntityMa
nager.java:376)
at
weblogic.ejb20.internal.EntityEJBHome.findByPrimaryKey(EntityEJBHome.java:33
2)
at
mcar.ejb.rbm.RBMCustomBean_ocyn82_HomeImpl.findByPrimaryKey(RBMCustomBean_oc
yn82_HomeImpl.java:99)
atmcar.ejb.rbm.RBMCustomBean_ocyn82_HomeImpl_WLSkel.invoke(Unknown
Source)
at
weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:298)
at
weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef.java
:93)
at
weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:267)
at
weblogic.rmi.internal.BasicServerRef.dispatch(BasicServerRef.java:166)
at
weblogic.rmi.internal.ServerRequest.sendOneWayRaw(ServerRequest.java:92)
at
weblogic.rmi.internal.ServerRequest.sendReceive(ServerRequest.java:112)
at
weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java
:262)
at
weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java
:229)
at weblogic.rmi.internal.ProxyStub.invoke(ProxyStub.java:35)
at $Proxy80.findByPrimaryKey(Unknown Source)
at
jsp_servlet.__HMqwestagentform._jspService(__HMqwestagentform.java:173)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:265)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:304)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:200)
at
weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletCo
ntext.java:2495)
at
weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java
:2204)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
End server side stack trace
<<no stack trace available>>
JSP Exception : java.lang.NullPointerException
java.lang.NullPointerException
at
jsp_servlet.__HMqwestagentform._jspService(__HMqwestagentform.java:181)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:265)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:304)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:200)
at
weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletCo
ntext.java:2495)
at
weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java
:2204)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
Thanks,
Ganesh -
FindNode returning Null And XML Not Accepting Special Characters
Hi All,
i am trying the get the attribute value in the element "ns4:InfoCFDi" using FindNode method, but the method is returning NULL. I used the same code for other sample as well and was successfull. but for this specific XML file(which is below) I am getting a Null.
i can get till S:Body, but when i try to use FindNode for ":Body/s4:ResponseGeneraCFDi" I get Null value.
And I used "S:Body/*[local-name()=" | "ns4:ResponseGeneraCFDi" | "]";
as mentioned in other post but still no success.
==>I Have one more question relating to special characters. I need to use characters such as - ó in my XML to read as well as write. When I try to read i am getting XML parse error and when writing, i cannot open the file properly.
Your help is much appreciated.
My code is here:
Local XmlDoc &inXMLDoc, &reqxmldoc;
Local XmlNode &RecordNode;
&inXMLDoc = CreateXmlDoc();
&ret = &inXMLDoc.ParseXmlFromURL("D:\Agnel\Mexico Debit Memo\REALRESPONSE.xml");
If &ret Then
&RecordNode = &inXMLDoc.DocumentElement.FindNode("" );
If &RecordNode.IsNull Then
Warning MsgGet(0, 0, "Agnel FindNode not found.");
rem MessageBox(0, "", 0, 0, "FindNode not found");
Else
&qrValue = &RecordNode.GetAttributeValue("asignaFolio ");
Warning MsgGet(0, 0, "asignaFolio." | &qrValue);
End-If;
Else
Warning MsgGet(0, 0, "Error. ParseXmlString");
End-If;
XML File:
- <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
- <S:Body>
- <ns4:ResponseGeneraCFDi xmlns="http://www.xxl.com/ns/xsd/bf/rxx/52" xmlns:ns2="http://www.sat.gob.mx/cfd/3" xmlns:ns3="http://www.xx/ns/bf/conector/1&quo t; xmlns:ns4="http://www.xx/ns/xsd/bfxx/xx/32&qu ot; xmlns:ns5="http://www.xxcom/ns/xsd/bf/xxxxx&q uot; xmlns:ns6="http://wwwxx.com/ns/referenceID/v1">
- <ns3:Result version="1">
<ns3:Message message="Proceso realizado con exito." code="0" />
</ns3:Result>
- <ns4:InfoCFDi noCertificadoSAT="20001000000100003992" refId="STORFAC20121022085611" fechaTimbrado="2012-10-22T08:56:45" qr=" "
uuid="a37a7d92-a17e-49f4-8e4d-51c983587acb" version="3.2" tipo="XML" archivo="xxx" sello="B8WjuhYLouSZJ6LU2EjxZ0a4IKyIENZNBx4Lb4 jkcAk6wA+EM477yz91/iDdsON0jm8xibBfom5hvHsH7ZK1ps3NnAXWr1LW 7ctmGsvYKAMvkCx/yOVzJTKFM2hN+OqCTE0WVfgv690vVy2CDQWKlMxbK+3idwG4t OKCMelrN9c=" fecha="2012-10-22T08:56:44" folio="281" serie="IICC">
<InfoEspecial valor="Este documento es una representacin impresa de un CFDI." atributo="leyendaImpresion" />
<InfoEspecial valor="||1.0|a37a7d92-a17e-49f4-8e4d-51c983587acb|2012-10-22T08:56:45|B8WjuhYLouSZJ6LU2EjxZ0a4IKyIENZNBx4Lb4 jkcAk6wA+EM477yz91/iDdsON0jm8xibBfom5hvHsH7ZK1ps3NnAXWr1LW 7ctmGsvYKAMvkCx/yOVzJTKFM2hN+OqCTE0WVfgv690vVy2CDQWKlMxbK+3idwG4t OKCMelrN9c=|20001000000100003992||" atributo="cadenaOriginal" />
<InfoEspecial valor="Doscientos dieciocho mil cuatrocientos setenta y cinco pesos 00/100 M.N." atributo="totalConLetra" />
</ns4:InfoCFDi>
</ns4:ResponseGeneraCFDi>
</S:Body>
</S:Envelope>
TIAFirst of all you have to supply a value you want to search for and this has to be the complete path to the value. You're saying you already tried that, but can you paste the code which you used for that? I don't see the path mentioned in the code you posted.
*FindNode*
Syntax
FindNode(Path)
Description
Use the FindNode method to return a reference to an XmlNode.
The path is specified as the list of tag names, to the node that you want to find, each separated by a slash (/).
Parameters
Path
Specify the tag names up to and including the name of the node that you want returned, starting with a slash and each separated by a slash (/). This is known as the XPath query language.>
Another option would be this snippet of code:
&InfoCFDiArray = GetElementsByTagName("ns4:InfoCFDi");
&InfoCFDiNode = &InfoCFDiArray [1];
&attValue = &InfoCFDiNode.GetAttributeValue("noCertificadoSAT")
Warning(&attValue);
It creates an array of XML Nodes which match the name "ns4:InfoCFDi". Since there's only one in the XML it's safe to assume it will be the one and only node in the array. I've assigned that node to the variable &InfoCFDiNode and use that to retrieve the attribute "noCertificadoSAT" value. The warning message should display the value supplied there.
Concering the special characters; you will have to change the encoding of the XML. Peoplecode sets this to UTF-8 by default, but doesn't include this in the header. There's a little hack for that somewhere on the web, I'll see if I can find it. -
Kff.where returns 'null' and causes sql error - looking for a work around
Hello,
I am using BI 5.6.3 in EBS (11.5.10.2)
I have created a kff.where as follows:
<lexical
type="oracle.apps.fnd.flex.kff.where"
name="lp_location_where_clause"
comment="Comment"
application_short_name="OFA"
id_flex_code="LOC#"
id_flex_num=":lp_location_flex_structure"
code_combination_table_alias="loc"
segments="ALL"
operator="BETWEEN"
operand1=":p_location_low"
operand2=":p_location_high"/>
</lexicals>
Everything works fine, as long as I have a values for the p_location_low and p_location_high. However, this is a parameter that comes in from a concurrent program and is optional. When the user doesn't pick a value, :p_location_low is the concatenated delimiters for the location '..'.
When this runs, the kff.where is returning null which causes 'Invalid Relational Operation error' because 'AND null' is not valid.
Warning in the log is :[091910_025232517][][STATEMENT] !!Warning: FlexAPI returns null for 'x_where_expression' lexical definition...
Does anyone have a workaround for this since making the parameter required is not an option for my users?
Thanks for reading.In your SQL*Plus session, make sure you
SQL> set define offbefore trying to create the Java stored procedure. SQL*Plus assumes that any string that begins with an & is a substitution variable unless you tell it that you have no substitution variables (via set define off).
Justin
Distributed Database Consulting, Inc.
http://www.ddbcinc.com/askDDBC
Maybe you are looking for
-
HT4061 How can I get out of this situation? I am out of ideas and DESPARATE
I tried to update my iPhone 4 with the latest update iOS 7.1 or whatever it's called and it wants me to restore my phone. Well it didn't ****ing tell me that before I downloaded the mother****er and I don't have my phone prepared. Basically I NEED th
-
Export to Excel is not supported for .XLSX in ECC 6.0
Hi, My Client use ECC 6.0 and Excel file is saved in client machine that has installed MS Excel 2010. Once file is exported to Excel ( Export -> Local File -> Spread sheet -> File Name ) , File name is saved as .XLS . File can not be saved as .XLSX .
-
Poture Validation of anti-virus products
Hi all I have recently setup set up NAC framework to support dot1x for wireless and wired clients. My ACS appliance is successfully authentication users via eap-fast using personal and machine certs and it successfully posture checks that the users a
-
Hello, We are using the clipper portlet to clip a backend j2ee web application. Now this backend application serves a html page with images, scripts, css and links as can be expected from any web page. What we would like to achieve is the static reso
-
Is there a mechanism to accelerate group discovery for smaller groups
It seems that 10.1 groups can take a long time to connect via stratus when there's only one previous person in the group. Is there a way to accelerate the first neighbor connection - perhaps by hinting the first neighbor identifier or similar? It's