SELECT A.PinCode ,A.Location ,A.Year ,SUM(CASE WHEN A.Area IN ('North Chennai', 'South Chennai') THEN A.Amount ELSE 0 END) AS total_amount_north_south ,SUM(CASE WHEN A.Area IN ('East Chennai', 'West Chennai') THEN A.Amount ELSE 0 END) AS total_amount_east_west ,SUM(A.Amount) AS Total_amount_for_Chennai FROM Tamilnadu GROUP BY A.PinCode ,A.Location ,A.Year
Monthly Archives: June 2015
Working with Key/Value Pairs Javascript
How can I add Key/Value pair to Object
var obj = { key1: value1, key2: value2 };
There are two ways to add new properties to an object
Method 1 – Using dot notation
obj.key3 = "value3";
Method 2 – Using square bracket notation
obj["key3"] = "value3";
The first form is used when you know the name of the property. The second form is used when the name of the property is dynamically determined. Like in this example:
var getProperty = function (propertyName) { return obj[propertyName]; }; getProperty("key1"); getProperty("key2"); getProperty("key3");
A real JavaScript array can be constructed using either:
The Array literal notation:
var arr = [];
The Array constructor notation:
var arr = new Array();
Javascript MultiDimensional Array
Simple 2 Dimensional Array
var grades = [[89, 77, 78],[76, 82, 81],[91, 94, 89]]; print(grades[2][2]);
Method 1
var numeric = [ ['input1','input2'], ['input3','input4'] ]; numeric[0][0] == 'input1'; numeric[0][1] == 'input2'; numeric[1][0] == 'input3'; numeric[1][1] == 'input4';
Method 2
var obj = { 'row1' : { 'key1' : 'input1', 'key2' : 'inpu2' }, 'row2' : { 'key3' : 'input3', 'key4' : 'input4' } }; obj.row1.key1 == 'input1'; obj.row1.key2 == 'input2'; obj.row2.key1 == 'input3'; obj.row2.key2 == 'input4';
Method 3
var mixed = { 'row1' : ['input1', 'inpu2'], 'row2' : ['input3', 'input4'] }; obj.row1[0] == 'input1'; obj.row1[1] == 'input2'; obj.row2[0] == 'input3'; obj.row2[1] == 'input4';
Creating a Multidimensional Array on Fly
var row= 20; var column= 10; var f = new Array(); for (i=0;i<row;i++) { f[i]=new Array(); for (j=0;j<column;j++) { f[i][j]=0; } }
Method to create a Javascript Multidimensional Array
Array.matrix = function(numrows, numcols, initial) { var arr = []; for (var i = 0; i < numrows; ++i) { var columns = []; for (var j = 0; j < numcols; ++j) { columns[j] = initial; } arr[i] = columns; } return arr; }
Sample Test Values
var nums = Array.matrix(5,5,0); print(nums[1][1]); // displays 0 var names = Array.matrix(3,3,""); names[1][2] = "Joe"; print(names[1][2]); // display "Joe"
Synonym for Oracle Procedures and Tables
For Procs
---for procs CREATE PUBLIC SYNONYM PROC_NAME FOR DATABASE_NAME.PROC_NAME; GRANT EXECUTE, DEBUG ON PROC_NAME TO ADMIN,ALL_DEVELOPERS;
For Tables
---for tables CREATE PUBLIC SYNONYM TABLE_NAME FOR TABLE_NAME_SYNONYM; GRANT INSERT,UPDATE,DELETE,SELECT ON TABLE_NAME TO ADMIN,ALL_DEVELOPERS;
Form reset wont work for hidden field
1.Form reset javascript does not work for hidden field
function resetForm() { document.getElementById("SetUpForm").reset(); }
The reset() functionality in javascript is intended for clearing user input, and since hidden inputs are not directly accessible by the user, it doesn’t make sense to allow the user to reset the hidden input’s value.
2.Dropdown should be reset by Javascript if selected is used.
The Same way this does not work in dropdown where the value is set to selected.The values of the dropdown should be manually reset by adding below code to above
function resetForm() { document.getElementById("SetUpForm").reset(); $("#cboAge").val(''); $("#cboCity").val(''); }