cancel
Showing results for 
Search instead for 
Did you mean: 

add value to column in matrix

Former Member
0 Kudos

hi

dim n as integer=10

dim tot as integer

omatrix = oForm.Items.Item("mtrx").Specific

For i = 1 To omatrix.RowCount

If Len(omatrix.Columns.Item("lcode").Cells.Item(i).Specific.value()) > 0 Then

valu = Integer.Parse(omatrix.Columns.Item("numdays").Cells.Item(i).Specific.value()) 'select empno from matrix rows

End If

Next

tot=valu-n

my question is

hw to add calculated tot value to column of the matrix

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

Try this code

dim n as integer=10

dim tot as integer

omatrix = oForm.Items.Item("mtrx").Specific

For i = 1 To omatrix.RowCount

If Len(omatrix.Columns.Item("lcode").Cells.Item(i).Specific.value()) > 0 Then

valu = Integer.Parse(omatrix.Columns.Item("numdays").Cells.Item(i).Specific.value()) 'select empno from matrix rows

tot+=valu

End If

Next

tot=valu-n

Regards,

Siva

Former Member
0 Kudos

thank u siva

but how to add the calculated tot value to column of the matrix

Former Member
0 Kudos

Hi

try this way

oedit1 = omatrix.Columns.Item("totcolumnid").Cells.Item(i).Specific

tot=oedit1.Value

regards,

Siva

Former Member
0 Kudos

thank

but i got error like conversion from string to int not valid

Former Member
0 Kudos

this is my code plz help me

Dim qrystr As String

Dim val As Integer 'declaration

Dim tt As Integer

Dim m As String

Dim i As Integer

Dim valu As Integer

omatrix = oForm.Items.Item("mtrx").Specific

For i = 1 To omatrix.RowCount

If Len(omatrix.Columns.Item("lcode").Cells.Item(i).Specific.value()) > 0 Then

valu = Integer.Parse(omatrix.Columns.Item("numdays").Cells.Item(i).Specific.value()) 'reading val from table

End If

Next

recset = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)

qrystr = "SELECT count(T0.[U_numdays]), T0.[U_empno] FROM [dbo].[@PLAFR1] T0 where T0.[U_empno]='5' group by T0.[U_empno]"

recset.DoQuery(qrystr)

val = recset.Fields.Item(0).Value

tt = valu - val

Dim oedit1 As SAPbouiCOM.EditText

omatrix2 = oForm.Items.Item("mtrx").Specific

For i = 1 To omatrix2.RowCount

If Len(omatrix2.Columns.Item("lcode").Cells.Item(i).Specific.value()) > 0 Then

oedit1 = omatrix2.Columns.Item("bal").Cells.Item(i).Specific

tt = oedit1.Value

End If

Next

Edited by: hareeshKR on Jul 28, 2011 9:35 AM

Former Member
0 Kudos

If your error is "conversion from string to int not valid" then you need to convert from a string to an int!

tt = oedit1.Value

should be

tt = Integer.Parse(oedit1.Value) 'Or Int.Parse(oedit1.Value) I cant remember syntax for VB

former_member689126
Active Contributor
0 Kudos

Hi

Try this

tt = ctype(oedit1.Value,integer)

Regards

Arun

Former Member
0 Kudos

thank u

Former Member
0 Kudos

If the question is answered please assign points and close the thread.

this is so in future if someone is searching they can see an answered thread and check it to see if it helps.