on 09-05-2013 7:49 AM
Hi all,
I have given a query in a grid where it has to fetch the values from the other table in a condition where the STATUS is given as YES alone,
it is fetching properly but the grid is a editable and after fetching the data from the table when i change the values in the grid it is not getting updated in my form.
How to solve this issue????
Help me solving this issue.
Following is my code,
Sub HRGrid()
Dim ocomboColumn As SAPbouiCOM.ComboBoxColumn
Dim oGrid As SAPbouiCOM.Grid
oGrid = objForm.Items.Item("grid1").Specific
objForm.DataSources.DataTables.Add("DT_0")
objForm.DataSources.DataTables.Item(0).ExecuteQuery("SELECT T0.[U_refID], T0.[U_canName], T0.[U_canMail], T0.[U_contact], T0.[U_refBy], T0.[U_refDate], T0.[U_resume], T0.[U_status] FROM [dbo].[@EAHCM_JBP2] T0, [dbo].[@EAHCM_JBP] T1 WHERE T0.[U_status] ='Yes' AND T0.[DocEntry]=T1.[DocEntry] AND T1.[U_reqNo]='" & objMain.JobPost.req & "' AND T1.[U_postNo]='" & objMain.JobPost.post & "' ")
oGrid.DataTable = objForm.DataSources.DataTables.Item("DT_0")
oGrid.Columns.Item("U_refID").TitleObject.Caption = "Referral Id"
oGrid.Columns.Item("U_refID").Visible = True
oGrid.Columns.Item("U_refID").Editable = False
oGrid.Columns.Item("U_canName").TitleObject.Caption = "Candidate Name"
oGrid.Columns.Item("U_canName").Visible = True
oGrid.Columns.Item("U_canName").Editable = False
oGrid.Columns.Item("U_canMail").TitleObject.Caption = "Candidate Mail"
oGrid.Columns.Item("U_canMail").Visible = True
oGrid.Columns.Item("U_canMail").Editable = False
oGrid.Columns.Item("U_contact").TitleObject.Caption = "Contact Number"
oGrid.Columns.Item("U_contact").Visible = True
oGrid.Columns.Item("U_contact").Editable = False
oGrid.Columns.Item("U_refBy").TitleObject.Caption = "Referred By"
oGrid.Columns.Item("U_refBy").Visible = True
oGrid.Columns.Item("U_refBy").Editable = False
oGrid.Columns.Item("U_refDate").TitleObject.Caption = "Date"
oGrid.Columns.Item("U_refDate").Visible = True
oGrid.Columns.Item("U_refDate").Editable = False
oGrid.Columns.Item("U_resume").TitleObject.Caption = "Resume"
oGrid.Columns.Item("U_resume").Visible = True
oGrid.Columns.Item("U_resume").Editable = False
oGrid.Columns.Item("U_status").Visible = False
oGrid.Columns.Item("U_status").Type = SAPbouiCOM.BoGridColumnType.gct_ComboBox
ocomboColumn = oGrid.Columns.Item("U_status")
ocomboColumn.ValidValues.Add("Selected", "SL")
ocomboColumn.ValidValues.Add("Waitinglist", "WL")
ocomboColumn.ValidValues.Add("Rejected", "RJ")
ocomboColumn.DisplayType = SAPbouiCOM.BoComboDisplayType.cdt_Value
oGrid.Columns.Item("U_status").TitleObject.Caption = "Status"
oGrid.Columns.Item("U_status").Visible = True
oGrid.Columns.Item("U_status").Editable = True
oGrid.AutoResizeColumns()
End Sub
Hye jananisuba,
please write alise to perticular column, and then check it will help you.
otherwise go to screen paintrr and check column property and updatef in your code.
Regards,
pradeep
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jananisuba,
Can you explain
'when i change the values in the grid it is not getting updated in my form.' ?
Regards
Edy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Edy,
I have also given a code to update the table after i change the values in the grid.
The green color highlighted line is not at all executing, when i debug and see it is showing "UNABLE TO EVALUATE THE EXPRESSION".
I have also attached the screen shots of my form.
In the first image, there is a grid in that the values changed must come and get updated in the next image matrix "Result" Column is my criteria.
Following is the code which i have given,
Case SAPbouiCOM.BoEventTypes.et_COMBO_SELECT
If pVal.ItemUID = "grid1" And pVal.BeforeAction = False Then
Dim oUserTable As SAPbobsCOM.UserTable
Dim strCode As String
Dim oTempRec As SAPbobsCOM.Recordset
oTempRec = objMain.objCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
oUserTable = objMain.objCompany.UserTables.Item("EAHCM_JBP2")
oGrid = oForm.Items.Item("grid1").Specific
For intRow1 As Integer = 0 To oGrid.DataTable.Rows.Count - 1
strCode = oGrid.DataTable.GetValue("U_result", intRow1)
'If strCode <> "" Then
oUserTable.Code = strCode
' If oUserTable.GetByKey(strCode) Then
oUserTable.UserFields.Fields.Item("U_result").Value = oGrid.DataTable.GetValue("U_result", intRow1)
'End If
'End If
Next
oTempRec.DoQuery("Update [@EAHCM_JBP2] set U_result=U_result")
End If
And check out the attachments.
Regards,
Jananisuba S
Hi Jana,
Your logic does not seem right.
You are trying to update the table every time the user change the combo box value. ?
You should let the user modify your form. Only after they are committing the form (By clicking on the Add/Update button). then you should update the table.
You need to change this codes under the After Item Pressed event of Button Add/Update.
And why the
oTempRec.DoQuery("Update [@EAHCM_JBP2] set U_result=U_result") ?
This would update all your record in this table (and I mean ALL) to U_result string.
Having said that,
You can update the table using :
strCode = oGrid.DataTable.GetValue("U_result", intRow1)
If strCode <> "" Then
If oUserTable.GetByKey(strCode) Then
oUserTable.UserFields.Fields.Item("U_result").Value = oGrid.DataTable.GetValue("U_result", intRow1)
oUserTable.Update();
End If
End If
Regards
Edy
User | Count |
---|---|
103 | |
12 | |
11 | |
6 | |
6 | |
4 | |
3 | |
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.