Wednesday, May 5, 2010

select any check box in the Grid then the remaning check boxes in the same column should hide automatically

select any check box in the Grid then the remaning check boxes in the same column should hide automatically

Level 0 = Org ID,Name
Level 1 = Org details
Level 2 = 3 Grids (Active locations,Primary Contact,Active Departments)


When we select any check box then the remaning check boxes in the same column should hide automatically.And the corresponding Name (Active locations,Primary Contact,Active Departments)which is in grid should be displayed in the Corresponding fields.

Write the following below code in the Component Record Level Field change event.

Local Rowset &RS0, &RS1, &RS2, &rs4;
&RS0 = GetLevel0();
&RS1 = &RS0(1).GetRowset(Scroll.SRI_STUORG1_TBL);
&CNT = 0;
For &I = 1 To &RS1.ActiveRowCount
&RS2 = &RS1(&I).GetRowset(Scroll.SRI_STUORG3_TBL);
For &J = 1 To &RS2.ActiveRowCount
&chk = &RS2.GetRow(&J).GetRecord(Record.SRI_STUORG3_TBL).GetField(Field.SRI_ORG_PRIMARY).Value;
&cr = CurrentRowNumber(2);


If &RS2.GetRow(&J).GetRecord(Record.SRI_STUORG3_TBL).GetField(Field.SRI_ORG_PRIMARY).Value = "Y" Then

&id = &RS2.GetRow(&J).GetRecord(Record.SRI_STUORG3_TBL).GetField(Field.SRI_ORG_CONTACTNO).Value;
&RS2.GetRow(&J).GetRecord(Record.SRI_STUORG3_TBL).GetField(Field.SRI_ORG_PRIMARYCOU).Value = &id;


&CNT = &CNT + 1;

For &p = 1 To &RS2.ActiveRowCount
REM WinMessage("in for ", 0);
&RS2.GetRow(&p).GetRecord(Record.SRI_STUORG3_TBL).GetField(Field.SRI_ORG_PRIMARY).Visible = False;
End-For;
&RS2.GetRow(&cr).GetRecord(Record.SRI_STUORG3_TBL).GetField(Field.SRI_ORG_PRIMARY).Visible = True;
REM WinMessage("count " | &CNT, 0);
End-If;

If &RS2.GetRow(&J).GetRecord(Record.SRI_STUORG3_TBL).GetField(Field.SRI_ORG_PRIMARY).Value = "N" And
&CNT = 0 Then

&RS2.GetRow(&J).GetRecord(Record.SRI_STUORG3_TBL).GetField(Field.SRI_ORG_PRIMARYCOU).Value = &id;
REM WinMessage("in if1", 0);
&RS2.GetRow(&J).GetRecord(Record.SRI_STUORG3_TBL).GetField(Field.SRI_ORG_PRIMARY).Visible = True;

End-If;


If &RS2.GetRow(&J).GetRecord(Record.SRI_STUORG3_TBL).GetField(Field.SRI_ORG_PRIMARY).Value = "N" And
&CNT > 0 Then

&RS2.GetRow(&J).GetRecord(Record.SRI_STUORG3_TBL).GetField(Field.SRI_ORG_PRIMARYCOU).Value = &id;
If &J <> &cr And
&RS2.GetRow(&cr).GetRecord(Record.SRI_STUORG3_TBL).GetField(Field.SRI_ORG_PRIMARY).Value = "Y" Then
REM WinMessage("in if2", 0);
&RS2.GetRow(&J).GetRecord(Record.SRI_STUORG3_TBL).GetField(Field.SRI_ORG_PRIMARY).Visible = False;
End-If;


If &RS2.GetRow(&cr).GetRecord(Record.SRI_STUORG3_TBL).GetField(Field.SRI_ORG_PRIMARY).Value = "N" Then
&RS2.GetRow(&J).GetRecord(Record.SRI_STUORG3_TBL).GetField(Field.SRI_ORG_PRIMARYCOU).Value = &id;
For &u = 1 To &RS2.ActiveRowCount
REM WinMessage("in if2", 0);
&RS2.GetRow(&u).GetRecord(Record.SRI_STUORG3_TBL).GetField(Field.SRI_ORG_PRIMARY).Visible = True;
End-For;
End-If;
End-If;

End-For;

End-For;

No comments:

Post a Comment