on 12-09-2014 3:20 PM
Hi,
I am working on a simple grid in VB.NET.
I have 2 UDF's:
Each time we tick a checkbox, the number 1 should appear in the same row in column U_HOV .
My next step is to achieve the foll. aim:
Hence, as we tick each required checkbox, U_HOV will be numbered in the sequence in which the checkboxes are ticked.
Ideally, if we untick any checkbox, the number on that row should disappear.
Why I want to do this?
In a next stage, I will sort the rows in order in which they are ticked.
It's an application for the Handing over of documents from Store to Accts Dept.
So this trick will remove the necessity of having to sort the documents manually before handing over.
I am short of ideas how to do this?
Anybody can give ideas and/or codes?
My basic code for the click event is as foll:How to modify?
Thanks
Leon Lai
----------------------
If FormUID = "frmGrid" And pVal.BeforeAction = False _
And pVal.EventType = SAPbouiCOM.BoEventTypes.et_CLICK _
And pVal.ItemUID = "MyGrid" _
And pVal.ColUID = "U_HandOver" Then
Dim oGridRow As Integer = pVal.Row
If oGrid.DataTable.GetValue("U_HandOver", oGrid.GetDataTableRowIndex(pVal.Row)).ToString() = "Y" Then
oGrid.DataTable.SetValue("U_HOV", oGrid.GetDataTableRowIndex(pVal.Row), 1)
'
End If
End If
Hi Leon,
Create a function that counts the number of checked checkboxes. Then use that + 1 to be the value to fill the U_HOV column.
If FormUID = "frmGrid" And pVal.BeforeAction = False _
And pVal.EventType = SAPbouiCOM.BoEventTypes.et_CLICK _
And pVal.ItemUID = "MyGrid" _
And pVal.ColUID = "U_HandOver" Then
Dim oGridRow As Integer = pVal.Row
Dim nextValue As Integer = CountChecked() + 1;
If oGrid.DataTable.GetValue("U_HandOver", oGrid.GetDataTableRowIndex(pVal.Row)).ToString() = "Y" Then
oGrid.DataTable.SetValue("U_HOV", oGrid.GetDataTableRowIndex(pVal.Row), nextValue)
Else
oGrid.DataTable.SetValue("U_HOV", oGrid.GetDataTableRowIndex(pVal.Row), "")
End If
End If
This is just one idea.
Best regards,
Pedro Magueija
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Pedro,
Thanks a lot for your reply.
Tomorrow is public holiday here, and I can only test the code on Thursday.
I will let you know.
But I've already grasped your clever idea:
Each time there is a click event, a function calculates how many rows are already clicked.Then, just add 1.
Unticked rows are also cared for.
Seems it will work. I'm impatient to try!
Best Regards,
Leon Lai
User | Count |
---|---|
102 | |
12 | |
11 | |
6 | |
5 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.