Monday, February 8, 2016


     
     
     
      
     
        
       
 
       
       
       
        
                   
        
         SELECT  Count(Sno) as NoOfAppsLTHr
         FROM  my_QRY_ITEMS
         WHERE  status=
         AND   AppComesFrom=
         AND   CustAccNo like 
         AND   myTime < 121
         AND    nydate between to_date('#NBetween1#','DD-MM-YYYY HH24:MI:ss') AND to_date('#NBetween2#','DD-MM-YYYY HH24:MI:ss')  
                   
        
         SELECT  Count(Sno) as NoOfAppsMTHr
         FROM  my_QRY_ITEMS
         WHERE  myStatus=
         AND   AppComesFrom=
         AND   CustAccNo like 
         AND   myTime > 120
         AND    myDate between to_date('#NBetween1#','DD-MM-YYYY HH24:MI:ss') AND to_date('#NBetween2#','DD-MM-YYYY HH24:MI:ss')  
          
        
        
        
        
       
       
       
     
            
               
               
               
               
               
               
           
 
           
 
          
         
       
    
       
       
         
                   
        
         SELECT  Count(Sno) as NoOfAppsLTHr
         FROM  my_QRY_ITEMS
         WHERE  myStatus=
         AND   AppComesFrom=
         AND   CustAccNo like 
         AND   myTime < 121
         AND    myDate between to_date('#NBetween1#','DD-MM-YYYY HH24:MI:ss') AND to_date('#NBetween2#','DD-MM-YYYY HH24:MI:ss')  
                   
        
         SELECT  Count(Sno) as NoOfAppsMTHr
         FROM  xxx_QRY_xxx
         WHERE  myStatus=
         AND   AppComesFrom=
         AND   CustAccNo like 
         AND   myTime > 120
         AND    myDate between to_date('#NBetween1#','DD-MM-YYYY HH24:MI:ss') AND to_date('#NBetween2#','DD-MM-YYYY HH24:MI:ss')  
          

        
        
        
        
        
        
        
          
          
          
            
               
               
               
               
               
               
               
               
            
            
           
         
        
          
        
        
       
      
      
     
     
    
     
    
     
    
     
 

Monday, September 1, 2014

Dear Friends,

Here I would like to share the query (Oracle DB) to fetch list of columns(comma separated) mapped to single column. i.e one column associated with multiple columns.
In below scenario, employee belongs to multiple departments.


COLUMN departments FORMAT A50

SELECT  emp.empemail,emp.empmobile, wm_concat(dept.empdeptno) AS departments
FROM   fos_empomer_dept dept inner join fos_empomer emp on dept.empid = emp.empid
and dept.deptActive =1
GROUP BY emp.empemail,emp.empmobile;   

SELECT dept.empid,emp.empemail,emp.empmobile, wm_concat(dept.empdeptno) AS departments
FROM   fos_empomer_dept dept inner join fos_empomer emp on dept.empid = emp.empid
and dept.deptActive =1
GROUP BY dept.empID,emp.empemail,emp.empmobile;   



The out put will be as below

+-----------------+------------------------------------+-----------------------+---------------------------------------+
   EmpID            EmpEmail                       EmpMobile            Departments
 +-----------------+-----------------------------------+-----------------------+---------------------------------------+
       101             raghu@fewa.gov.ae              1234                   sales,purchase,audit
+-----------------+------------------------------------+-----------------------+---------------------------------------+



Happy Coding!

Thank you,
Raghuram Reddy Gottimukkula
Adobe Certified Professional in Advanced ColdFusion
Dubai, UAE

Sunday, April 7, 2013

Sunday, May 15, 2011

Dashboard Development using ColdFusion


Code Under construction:
------------------------------

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Dashboard -- Raghuram</title>
</head>

<body>
<cfpod name="pod01" headerstyle="background-color:brown; color:yellow;" bodystyle="background-color:gray; color:red;" height="325" width="1000"
title="Dashboard-Reporting">
<cfwindow
title="Contrast Window" name="contrast"
x="0" y="20"
draggable="true" resizable="true"
width="280" height="350" initShow="true">
</cfwindow>
<cfwindow
title="Grid Window" name="gridWindow"
x="280" y="20"
draggable="true" resizable="true"
width="390" height="350" initShow="true">
<!--- Query the database to fill up the grid.
SELECT Course_ID, Dept_ID, CorNumber,CorName, CorLevel
--->
<cfquery name = "GetCourses" dataSource = "cfdocexamples">
SELECT Dept_ID, CorName, CorLevel
FROM CourseList
ORDER by Dept_ID ASC, CorNumber ASC
</cfquery>

<h3>Exception Summary </h3>
<i>Grid View</i>
<!--- cfgrid must be inside a cfform tag. --->
<cfform>
<cfgrid name = "FirstGrid" format="Flash"
height="320" width="580"
font="Tahoma" fontsize="12"
query = "GetCourses">
</cfgrid>
</cfform>
</cfwindow>
<!---cfchart example --->
<!---The following example analyzes the salary data in the cfdocexamples database and
generates a bar chart showing average salary by department. The body of the
cfchartseries tag includes one cfchartdata tag to include data that is not available
from the query. --->

<!--- Get the raw data from the database. --->
<cfquery name="GetSalaries" datasource="cfdocexamples">
SELECT Departmt.Dept_Name,
Employee.Dept_ID,
Employee.Salary
FROM Departmt, Employee
WHERE Departmt.Dept_ID = Employee.Dept_ID
</cfquery>

<!--- Use a query of queries to generate a new query with --->
<!--- statistical data for each department. --->
<!--- AVG and SUM calculate statistics. --->
<!--- GROUP BY generates results for each department. --->
<cfquery dbtype = "query" name = "DataTable">
SELECT Dept_Name,
AVG(Salary) AS avgSal,
SUM(Salary) AS sumSal
FROM GetSalaries
GROUP BY Dept_Name
</cfquery>

<!--- Reformat the generated numbers to show only thousands. --->
<cfloop index = "i" from = "1" to = "#DataTable.RecordCount#">
<cfset DataTable.sumSal[i] = Round(DataTable.sumSal[i]/1000)*1000>
<cfset DataTable.avgSal[i] = Round(DataTable.avgSal[i]/1000)*1000>
</cfloop>

<cfwindow
title="Test Window2" name="myWindow2"
x="670" y="20"
draggable="true" resizable="true"
width="340" height="350" initShow="true">

<h1>Employee Salary Analysis</h1>
<!--- Bar graph, from Query of Queries --->
<cfchart format="flash"
xaxistitle="Department"
yaxistitle="Salary Average">

<cfchartseries type="bar"
query="DataTable"
itemcolumn="Dept_Name"
valuecolumn="avgSal">

<cfchartdata item="Facilities" value="35000">

</cfchartseries>
</cfchart>
</cfwindow>
</cfpod>
<cfpod name="pod03" title="Exception Report" bodystyle="background-color:MediumOrchid; color:yellow;" height="8" width="1000">
test middle pod
</cfpod>
<cfpod name="pod02" title="Summary Report" headerstyle="background-color:brown;" bodystyle="background-color:lightGray; color:red;" height="250" width="1000">
<!---<cfwindow
title="Test Window3" name="myWindow3"
x="250" y="470"
draggable="true" resizable="true"
width="200" height="200" initShow="true" >
</cfwindow>--->
</cfpod>


</body>
</html>

Friday, April 1, 2011

DB Connection code in Dotnet for Begineers

It should be in aspx.cs
using System.Data;
using System.Data.SqlClient;
using System.Configuration;

string connectionInfo = ConfigurationManager.ConnectionStrings["PDFConnectionString"].ConnectionString;
// Creates Db Connections
SqlConnection myConnection = new SqlConnection(connectionInfo);


myConnection.Open();
objCmd = new SqlCommand("SELECT OrderNumber FROM [dbo].tblEorder WHERE eOrderID = (SELECT eOrderID FROM [dbo].tblTempToken WHERE TempToken='" + strPDFToken + "')", myConnection);
ObjDR = objCmd.ExecuteReader();

//Get PURLtoken(OrderNumber) for the requested form
while (ObjDR.Read())
{
purltoken = ObjDR["OrderNumber"].ToString();
// Return to Main URL. - Executes client side script
string jScriptString;
/*jScriptString = "<script> parent.window.close(); \n" +
"window.opener.close(); window.opener.opener.location.href = " + "'http://bltrdevm58072/eproducts360/BRWSDemo/main.html?token=" + purltoken + "&formpage=true'";
jScriptString += " </script>";*/
jScriptString = "<script> var objWin=window.opener; parent.window.close(); \n" +
"window.opener.close();objWin.opener.location.href = " + "'http://bltrdevm58072/eproducts360/BRWSDemo/main.html?token=" + purltoken + "&formpage=true'";
jScriptString += " </script>";
ClientScript.RegisterClientScriptBlock(this.GetType(), "clientScript", jScriptString);
}

Web.config
<connectionStrings>
<add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient"/>
<add name="PDFConnectionString" connectionString="Data source=blitswargd01\sql81;User ID=cf;Password=powercf;Initial Catalog=E360MTJan;"/>

</connectionStrings>

Friday, July 9, 2010

Crazy While loop


People go Crazy some times...im no more exception to that.
Hari n Sangam Raju forced me to write this....CC to Soman Aradhya :)


while loop in java
while (expression) {
statement(s)
}
eg: int noOfKiss=0;
While (isTrishaAlive()){
kisstoHarish(); noOfKiss++;}

coldfusion while loop:

<cfloop condition="myVar eq false">
<cfoutput>i am in while loop
</cfloop>

javascript while loop:

<script type="text/javascript">
var i=0;
while (i<=5)
{
document.write("The number is " + i);
document.write("<br />");
i++;
}
</script>

C while loop:
#include<stdio.h>

main(){

int i = 0;
while (i<5){
printf(" the value of i is %d\n", i);
i = i + 1;
}
}

python while loop:
#!/usr/bin/python

count = 0
while (count < 9):
print 'The count is:', count
count = count + 1

print "Good bye!"

JSP while loop:
<%
int value = 5;

while (value > 0) {
out.println("The value is now " + value-- + ".<BR>");
}
%>

ASP while loop:
<%
Do While thenumber<10
Resonse.Write("Less than 10")
thenumber = thenumber + 1
Loop
%>


JSF while loop:
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html">
<ui:repeat value="#{TableBean.perInfoAll}" var="info">
<li>
<h:inputText value="#{info.id}" />
<h:inputText value="#{info.name}" />
</li>
</ui:repeat>

PHP while loop:
$brush_price = 5;
$counter = 10;

echo "<table border=\"1\" align=\"center\">";
echo "<tr><th>Quantity</th>";
echo "<th>Price</th></tr>";
while ( $counter <= 100 ) {
echo "<tr><td>";
echo $counter;
echo "</td><td>";
echo $brush_price * $counter;
echo "</td></tr>";
$counter = $counter + 10;
}
echo "</table>";


PERL while loop:
#!/usr/bin/perl

print "content-type: text/html \n\n";

# SET A VARIABLE
$count = 0;

# RUN A WHILE LOOP
while ($count <= 7) {
# PRINT THE VARIABLE AND AN HTML LINE BREAK
print "$count<br />";
# INCREMENT THE VARIABLE EACH TIME
$count ++;
}
print "Finished Counting!";

VB while loop:

Dim counter As Integer = 0
While counter < 20
counter += 1
' Insert code to use current value of counter.
End While
MsgBox("While loop ran " & CStr(counter) & " times")

SQL server2005 while loop:
DECLARE @intFlag INT
SET @intFlag = 1
WHILE (@intFlag <=5)
BEGIN
PRINT @intFlag
SET @intFlag = @intFlag + 1
END
GO

BASH while loop:
#!/bin/bash
c=1
while [ $c -le 5 ]
do
echo "Welcone $c times"
(( c++ ))
done

KSH while loop:

#!/bin/ksh
c=1
while [[ $c -le 5 ]]; do
echo "Welcome $c times"
(( c++ ))
done

CSH while loop:

#!/bin/csh
c=1
while ( $c <= 5 )
echo "Welcome $c times"
@ c = $c + 1
end

other CSH while loop:
#!/bin/csh
set yname="foo"
while ( $yname != "" )
echo -n "Enter your name : "
set yname = $<
if ( $yname != "" ) then
echo "Hi, $yname"
endif
end


Do you ever heard about "while" loop in programming language?

while loop syntax thelsa

I didnt know what to respond for that



Image source: http://www.webdeveloperjuice.com/wp-content/uploads/2010/03/14_eac33_9_600.jpg