Tuesday, May 16, 2017

Column merging as group in Infragistics Ultra Win Grid



Column merging as group in Infragistics Ultra Win Grid


If you want to merge columns as group like excel as shown in the below


 
Well Information
WellID
WellName
Address
1
well1
houston,tx
2
well2
dallas,Tx


 


 


 


 


 
Event
Vb.net code:
 Private Sub ugMain_InitializeLayout(sender As Object, e As InitializeLayoutEventArgs) Handles ugMain.InitializeLayout
        Dim wellGroup As UltraGridGroup = Nothing


        Dim readOnlyGroup As UltraGridGroup = Nothing


        ' Clear existing groups if any.


        e.Layout.Bands(0).Groups.Clear()




        ' Add two groups with two different keys. First arguement to the Add call is


        ' the key and the second arguement is the caption of the group.


        wellGroup = ugMain.DisplayLayout.Bands(0).Groups.Add("WellGroup", "Well Info")


        readOnlyGroup = ugMain.DisplayLayout.Bands(0).Groups.Add("ReadOnlyGroup", "Read Only")
 


        e.Layout.Bands(0).Columns("WellID").Group = wellGroup


        e.Layout.Bands(0).Columns("WelName").Group = wellGroup


        e.Layout.Bands(0).Columns("Address").Group = wellGroup




        e.Layout.Bands(0).Override.HeaderAppearance.TextHAlign = Infragistics.Win.HAlign.Center


        e.Layout.Bands(0).Override.HeaderAppearance.FontData.Bold = DefaultableBoolean.True




    End Sub


C#.net code:
Protected  void ugMain_InitializeLayout(object sender, InitializeLayoutEventArgs e)


{


       UltraGridGroup wellGroup = null;


       UltraGridGroup readOnlyGroup = null;


       // Clear existing groups if any.


       e.Layout.Bands(0).Groups.Clear();


 


       // Add two groups with two different keys. First arguement to the Add call is


       // the key and the second arguement is the caption of the group.


       wellGroup = ugMain.DisplayLayout.Bands(0).Groups.Add("WellGroup", "Well Info");


       readOnlyGroup = ugMain.DisplayLayout.Bands(0).Groups.Add("ReadOnlyGroup", "Read Only");


 


       e.Layout.Bands(0).Columns("WellID").Group = wellGroup;


       e.Layout.Bands(0).Columns("WelName").Group = wellGroup;


       e.Layout.Bands(0).Columns("Address").Group = wellGroup;


 


 


       e.Layout.Bands(0).Override.HeaderAppearance.TextHAlign = Infragistics.Win.HAlign.Center;


       e.Layout.Bands(0).Override.HeaderAppearance.FontData.Bold = DefaultableBoolean.True;


 


}


 

Column Locking / Freezing in Infragistics Ultra Win Grid

Column Locking / Freezing in Infragistics Ultra Win Grid
If you want to freeze first few columns like EXCEL and horizontally scroll rest of the columns in Ultra Win Grid here you go…
Event :
VB.net code
Private Sub ugMain_InitializeLayout (sender As Object, e As InitializeLayoutEventArgs) Handles ugMain.InitializeLayout
 
        e.Layout.UseFixedHeaders = True
        e.Layout.Bands(0).Columns(1).Header.Fixed = True
        e.Layout.Bands(0).Columns(2).Header.Fixed = True
 
End Sub
 
 
 
C#.net Code
 
   Protected void ugMain_InitializeLayout (object sender, InitializeLayoutEventArgs e)
{
       e.Layout.UseFixedHeaders = true;
       e.Layout.Bands(0).Columns(1).Header.Fixed = true;
       e.Layout.Bands(0).Columns(2).Header.Fixed = true;
 
}
 

Monday, May 15, 2017

SQL JOINS

I am going to explain about the Joins .they are four different types. 

  • Left Join
  • Right Join
  • Inner Join (self-Join)
  • Cross join
Left Join 

The LEFT JOIN keyword returns all records from the left table (table1), and the matched records from the right table (table2). The result is NULL from the right side, if there is no match.


 


 


 


 


ProjectUID
ProjectTitle
ProjectType
14
New Home Dome Project
NULL
20
No Project (SOUTHERN)
NULL
25
Cypress Pipeline Project
NULL
50
South System Expansion III
Loop
50
South System Expansion III
Replacement
Example:   SELECT p1.[ProjectUID]

      ,p1.[ProjectTitle] 

         , s1.ProjectType    

  FROM [ROWDMAP].[dbo].[tblProjects] p1

  left join tblProjectProjectTypes p2   on p1.ProjectUID=p2.ProjectUID

  left join tblStaticProjectType s1 on p2.ProjectTypeNo =s1.ProjectTypeNo


  where p1.DataOriginGroup='SOUTHERN'


Right Join: 

The RIGHT JOIN keyword returns all records from the right table (table2), and the matched records from the left table (table1). The result is NULL from the left side, when there is no match.


 

 

 


 

 

 


ProjectUID
ProjectTitle
ProjectType
50
South System Expansion III
Loop
50
South System Expansion III
Replacement
245
South System IV
Loop
245
South System IV
Greenfield
245
South System IV
Replacement


 


Example:  SELECT p1.[ProjectUID]


      ,p1.[ProjectTitle] 


         ,s1.ProjectType    


  FROM [ROWDMAP].[dbo].[tblProjects] p1


  right join tblProjectProjectTypes p2   on p1.ProjectUID=p2.ProjectUID


  right join tblStaticProjectType s1 on p2.ProjectTypeNo =s1.ProjectTypeNo


  where p1.DataOriginGroup='SOUTHERN'


 
Inner Join:


The SQL Inner JOIN is used to join a table to itself as if the table were two tables; temporarily renaming at least one table in the SQL statement.

ProjectTitle
ScopeOfWork
New Home Dome Project
Washington County to Yuma County, Colorado
No Project (SOUTHERN)
Washington County to Yuma County, Colorado
Cypress Pipeline Project
Washington County to Yuma County, Colorado
South System Expansion III
Washington County to Yuma County, Colorado
Elba Express
Washington County to Yuma County, Colorado
New Home Dome Project
NULL
No Project (SOUTHERN)
NULL
Cypress Pipeline Project
NULL
South System Expansion III
NULL


Example :

select p1.ProjectTitle,p2.ScopeOfWork    From tblProjects p1 inner join tblProjects p2

on p1.ProjectUID <>p2.ProjectUID

where    p1.DataOriginGroup='SOUTHERN' and p2.CompanyNo =22

 Cross Join:

The CARTESIAN JOIN or CROSS JOIN returns the Cartesian product of the sets of records from two or more joined tables. Thus, it equates to an inner join where the join-condition always evaluates to either True or where the join-condition is absent from the statement.



 


 


 

  

ProjectTitle
ProjectTypeNo
0001-A-Abandoned
7
106-recoat 101-1 to 106-1 CAO
1
2010 PIP Firefly OH
6
2012 Anom Rem (261-2 to 267-2)
7
300 Line Expansion
2
300 Line Expansion
8
342-Expose Pipe @ Easton, CT
6
4240 - Marlin Midstream
5
4243 - Lymac Exploration
5
4250 - Cheif Gathering Elliot
5

 

 

Example :


select p1.ProjectTitle,p2.ProjectTypeNo    From tblProjects p1 cross join tblProjectProjectTypes p2


where  p1.ProjectUID =p2.PRojectUID