Check Combo in Matrix
Hi,
How do I check whether a combo is selected? The combo is bind to the matrix using screen painter.
I have tried this but it is not working:
oMatrix.Columns("ColName").Cells.Item(i).Specific.Selected.Value = ""
I am using VB and 2004B. Help appreciated.
Hi,
If ((pVal.EventType = SAPbouiCOM.BoEventTypes.et_GOT_FOCUS And pVal.ItemUID = "Matrix1" And pVal.ColUID = "ColumnID" And pVal.Before_Action = False)) Then
oCombo = oMatrix.Columns.Item(pVal.ColUID).Cells.Item(pVal.Row).Specific
If oCombo.Selected Is Nothing Then
oCombo.Select(0, SAPbouiCOM.BoSearchKey.psk_Index)
Else
SBO_Application.MessageBox("Combo selected")
End If
End If
This event gives me a selection even before losing the focus of combobox item.
Hope it may be of use to u.
Cheers
Manu
Similar Messages
-
Greetings All,
Does anyone know how i can check if a matrix row is enabled or disabled prior to updating the field? I need to know because my add on is throwing an exception stating invalid form item if the matrix row is disabled.
Any ideas?Hi Curtis
I'm not aware if you can make a row enabled or disabled...never seen it. I know you can make a whole matrix enabled or disabled. Also if you want an extra line in the matrix you add a extra one and that then becomes available. When you say disabled is this when you haven't said you want an extra row and it doesn't allow to add the row details?
Well, to check if a matrix is enabled you do something like
Dim item As SAPbouiCOM.Item
item = oForm.Items.Item("matrixID")
If item.Enabled = False Then item.Enabled = True
Then to see how many records are in your matrix use
oMatrix.RowCount
It will return the number of records in the matrix. But remeber if its your own matrix you should always add a line omatrix.addrow before specifying the row contents.
Hope this helps -
Check box in matrix column bind correctly but doesn't appear check sign
Dear Sirs,
I have a check box in a matrix column (the matrix is placed i an extra folder in the item master data form).
The column is bound to a DBDataSource related to the user defined table @IIT_ITM1 as reported in the following code. The table field bound to the check box column is alphanumeric of size 1.
I use the following code:
oCln = oMtx.Columns.Add("Per_coll", SAPbouiCOM.BoFormItemTypes.it_CHECK_BOX);
oCln.DisplayDesc = true;
oCln.Description = "For test";
oCln.TitleObject.Caption = "For test";
oCln.ValOn = "Y";
oCln.ValOff = "N";
oCln.Width = 60;
oCln.DataBind.SetBound(true, "@IIT_ITM1", "U_IIT_PerColl");
oCln.Editable = true;
The problem is: the binding to the database work (if I click on the check box and save the data, then the database content change accordingly) but I CANNOT LET THE USER SIGN APPEAR on the check box control!
Does anyone have the solution?
Thank you for help
MassimoNo response from the forum
-
Hi,
I have a Matrix.
In Each row i want like to populate matrix with values based on the row.
My problem is once a combo gets populated in one row, the same value
gets populated for other rows also(inspite of changing values)
This is my code
Do Until rsWHID.EoF = True
i = i + 1
Dim sLength As String
sLength = rsWHID.Fields.Item("Length").Value
WHOH_Form.DataSources.UserDataSources.Item("usLot").ValueEx = ""
Dim sDate As String = Convert.ToString(rsWHID.Fields.Item("DueDate").Value)
WHOH_Form.DataSources.UserDataSources.Item("usDate").ValueEx = Convert.ToString(sDate).Replace(".", "")
WHOH_Matrix.AddRow()
sQuerySOWO = "select u_ORDER,U_SOWO from [@CDIplanorders] WHERE u_iTEMcODE='" & sItemNo & "' AND u_lENGTH='" & sLength & "'"
rsSOWO.DoQuery(sQuerySOWO)
WHOH_Form.DataSources.UserDataSources.Item("usCmboSOWO").ValueEx = ""
WHOH_Combo = WHOH_Matrix.Columns.Item("cmbSOWO").Cells.Item(i).Specific
For j = WHOH_Combo.ValidValues.Count - 1 To 0 Step -1
WHOH_Combo.ValidValues.Remove(j, SAPbouiCOM.BoSearchKey.psk_Index)
Next j
If Not rsSOWO.EoF() Then
Do Until rsSOWO.EoF = True
Dim strOrderNO, strWOorSO As String
strOrderNO = rsSOWO.Fields.Item("u_ORDER").Value
strWOorSO = rsSOWO.Fields.Item("u_SOWO").Value
WHOH_Combo.ValidValues.Add(strOrderNO, strWOorSO)
rsSOWO.MoveNext()
Loop
End If
rsWHID.MoveNext()
Loop
Pls help.The design of the matrix implies that all row-comboboxes have the same data, you cannot change that.
Maybe use the double click event to popup a form and show the different possible values depending on the row -
Hi,
How can I populate a combo box in a matrix with different values?
The combobox will have a dynamic data coming from a table for each description.
Supposed, if I my matrix would look like the following.
Description Option(combobox)
ABC Yes/No
DEF Excellent/Good/Poor
GHI High/Medium/Low
How would I do it?
Thanks,Hi jaun,
you write the code in Key_Down Event Of Description field
'Assuming clCombo as Combobox column,DESCUID as Description field ColUID and it is Edit Text
If Description field is also combo box then you add this code in Combo_Select in before action false
if pVal.ColUid="DESCUID" and Pval.Row>0 then
dim objCombo as SAPbobsUICOM.ComboBox
dim i as integer
objCombo =objMatrix.Columns.Item("clCombo").Cells.Item(Pval.Row).Specific
for int=0 to objCombo.ValidValues.Count-1
objCombo.ValidValues.Remove(0)
Next
if objMatrix.Columns.Item("DESCUID").Cells.Item(Pval.Row).Specific.Value="ABC" then
objCombo.ValidValues.ADD("Y","YES")
objCombo.ValidValues.ADD("N","NO")
end if
if objMatrix.Columns.Item("DESCUID").Cells.Item(Pval.Row).Specific.Value="ABC" then
objCombo.ValidValues.ADD("E","EXCLLENT")
objCombo.ValidValues.ADD("G","GOOD")
objCombo.ValidValues.ADD("P","POOR")
end if
if objMatrix.Columns.Item("DESCUID").Cells.Item(Pval.Row).Specific.Value="ABC" then
objCombo.ValidValues.ADD("H","HIGH")
objCombo.ValidValues.ADD("M","MEDIUM")
objCombo.ValidValues.ADD("L","LOW")
end if
End if
Hope it helps you
Regards
Vishnu -
Hi All,
I have created a matrix with priceunitColumn.this field is linked to a no Object type table.My problem is iam not getting the define new option in the combo.Also i cant get all the values from the table in the combo.How should i achieve this.
Thanx in advance.
Regards
MohanaHi..
Try this code it will work..
Dim oPopUp As SAPbouiCOM.Form REM Define New Form (Global)
Private Sub LoadFromXml(ByVal fileName As String)
Dim XmlDoc As Xml.XmlDocument
Dim Xmlstr As String
XmlDoc = New Xml.XmlDocument
Dim SPath As String
Try
SPath = IO.Directory.GetParent(Application.StartupPath).ToString
XmlDoc.Load("C:\Program Files\SAP\SAP Business One\AddOns\Ur Srf Folder" & "\" & fileName)
SBO_Application.LoadBatchActions(XmlDoc.InnerXml)
oPopUp = SBO_Application.Forms.Item("define sfr form ID")
Catch ex As Exception
SBO_Application.MessageBox(ex.Message)
End Try
oPopUp.Visible = True
End Sub
Item Event
If pVal.FormUID = "UID" And pVal.ItemUID = "ComboID" And pVal.BeforeAction = False And pVal.EventType = SAPbouiCOM.BoEventTypes.et_COMBO_SELECT Then
Try
ocombo = FormS.Items.Item("ID").Specific
If ocombo.Selected.Value = "-9" Then
LoadFromXml("Define NewSRF .srf")
End If
Catch ex As Exception
SBO_Application.MessageBox(ex.Message)
End Try
End If
Regards..
Billa 2007 -
How to add combo in system matrix ? I am adding a column in the matrix of A/R invoice.I am using the following code-
Dim matMatrix As SAPbouiCOM.Matrix
Dim objColumn As SAPbouiCOM.Column
Dim ddlAP As SAPbouiCOM.ComboBox
objForm = SBO_Application.Forms.ActiveForm
If objForm.DataSources.UserDataSources.Count = 228 Then
objForm.DataSources.UserDataSources.Add("ddlAP", SAPbouiCOM.BoDataType.dt_LONG_TEXT, 50)
End If
matMatrix = objForm.Items.Item("38").Specific
matMatrix.Clear()
If matMatrix.Columns.Count = 265 Then
objColumn = matMatrix.Columns.Add("AP", SAPbouiCOM.BoFormItemTypes.it_COMBO_BOX)
Else
objColumn = matMatrix.Columns.Item("AP")
End If
objColumn.DataBind.SetBound(True, "", "ddlAP")
'objColumn.TitleObject.Caption = "AP Invoice"
objColumn.Width = 100
objColumn.Visible = True
matMatrix.Columns.Item("AP").DisplayDesc = True
matMatrix.Columns.Item("AP").TitleObject.Caption = "A/P Invoice"
ddlAP = matMatrix.Columns.Item("AP").Cells.Item(0).Specific
objForm.Refresh()
But the combo is note getting displayed.Hi Dilip,
You cannot change (add or modify) a system matrix via SDK. If you need to add a ComboBox in a system matrix you need to create a UserField with ValidValue or connected to a User Table.
Regards,
Vítor Vieira -
hi
im using combo in my matrix
how to load data from database table to column(ocombo) of the matrix
plz help me
Edited by: hareeshKR on Jul 18, 2011 12:37 PM
Edited by: hareeshKR on Jul 18, 2011 1:15 PMHi,
ObjMatrix = ObjForm.Items.Item("6").Specific
ObjCombo = ObjMatrix.Columns.Item("4").Cells.Item(row).Specific
strSQL="Select Code,ItemName from OITM"
obRS= objAddOn.objCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
objRS.doQuery(strSQL)
for i=1 to objRS.recordcount
ObjCombo.ValidValues.Add(ObjRS.Fields.Item("Code").Value, ObjRS.Fields.Item("ItemName").Value)
ObjRS.MoveNext()
Next -
Combo inside matrix, help me
Dear all,
In my application i have combox in matrix, Values of combo i added (1, 2,3,4...). now when user click button in form it will assign for combobox is 1 or 2 ..... I try this code but error"
oComboBox = oMatrix.Columns.Item(colName.ToString).Cells.Item(i + 1).Specific()
oComboBox.Select(1, SAPbouiCOM.BoSearchKey.psk_ByValue)
Please help me. THanksWhat is the error message?
Im using it as
For q = 1 To Matrix.RowCount
com = Matrix.Columns.Item("c1").Cells.Item(q).Specific
com.Select(0, SAPbouiCOM.BoSearchKey.psk_Index)
Next q
and its working. -
Hola a todos.... el problema que tengo y espero me puedan ayudar es que tengo un matrix de sap, pero nesesito que una de las columnas de ese matrix en ves de mostrar texto me muestre un combo con informnacion de los turnos de una empresa ....alguien me puede ayudar .. este es el codigo que estoy ocupando:
For Li_Fila = 0 To Lo_Personal.TotalFilas - 1
Lo_Personal.Fila = Li_Fila
Lo_UserDataSource = Mo_Forma.DataSources.UserDataSources.Item(MatrixCambiaTurnosNumero)
Lo_UserDataSource.Value = Lo_Personal.Empleado
Lo_UserDataSource = Mo_Forma.DataSources.UserDataSources.Item(MatrixCambiaTurnosOriginal)
Lo_UserDataSource.Value = Lo_Personal.TurnoDescripcion
''En esta columna es en la que deseo mostrar el combo.....
__Lo_UserDataSource = Mo_Forma.DataSources.UserDataSources.Item(MatrixCambiaTurnosCambio)__
__Lo_UserDataSource.Value =Lo_cboTunos.Selected.Description__
Lo_grdMatrixCambiaTurnos.AddRow()
Next
Asi como lo tengo ahora me muestra la forma de combo con un valor pero al darle click no me despliega el resto de los valores....
alguien sabe como puedo solucionar esto
De antemano les agradesco ....Jorge Luis
Sobre el punto que mencionas te puedo decir lo siguiente:
' Creando los UserDataSources para la columna tipo combo
oMyForm.DataSources.UserDataSources.Add("udsColumna", SAPbouiCOM.BoDataType.dt_SHORT_TEXT)
oMatrix = oMyForm.Items.Item(MyMatrix).Specific
oColumns = oMatrix.Columns
' Asignando el UserDataSources a la columna tipo combo
oColumns.Item("c_Columna").DataBind.SetBound(True, "", "udsColumna")
oMatrix = oMyForm.Items.Item(MyMatrix).Specific
oColumns = oMatrix.Columns
' Agregando valores al combo de la columna tipo combo
oColumns.Item("c_Columna").ValidValues.Add("M", "Mañana")
oColumns.Item("c_Columna").ValidValues.Add("T", "Tarde")
oColumns.Item("c_Columna").ValidValues.Add("N", "Noche")
oColumns.Item("c_Columna").DisplayDesc = True
oRecordSet.DoQuery("SELECT CODE, NAME FROM [@TABLE]")
Dim index As Integer = 1
' Cargando valores a las filas de la matrix
oMatrix = oMyForm.Items.Item(MyMatrix).Specific
While Not oRecordSet.EoF
oMatrix.AddRow(1)
oMatrix.GetLineData(index)
oUserDataSource = oMyForm.DataSources.UserDataSources.Item("udsColumna")
oUserDataSource.Value = oRecordSet.Fields.Item("CODE").Value.ToString.Trim
oMatrix.SetLineData(index)
index += 1
oRecordSet.MoveNext()
End While
Si revisas bien este codigo primero llenas la columna que es tipo combo con sus valores posibles, puedes usar un oRecordSet para llenarla si es que los datos los tienes en una tabla y pueden varias.
Al usar UserDataSource en una matrix debes usar las funciones GetLineData(index) y SetLineData(index).
Bueno espero que esto aclare tus dudas, si todo sale bien seria bueno que lo comentes.
Saludos
George -
Matrix Empty row Binding Problem
Hi ,
i created one matrix using screen painter.. all my columns are binded
with user defined fields.(Doc Rows Table). if my total row count is 5.
and i deleted 2 rows using rightclick deleterow event. after adding if i see the same document it display the 2 empty rows and 3 rows with my details.. actually its showing that deleted row also.my UDT also having empty row details..
how to resolve this?
Regards,
Ganesh KHi Geetha,
i think you misunderstood my scenario. while adding no empty rows
are displayed, even if i deleted some added row details.After adding,
while retriving the same document the problem occurs.if am not clear let me know..
As you told, beforeAction = false of Add will be new form with Add mode.so not possible to check that old matrix. otherwise we can delete the empty details from database using query..in beforeaction false pval.actionsucess true part...
regards,
Ganesh k. -
hello sir
I am working on UDO Concepts,I created one screen same as PurchaseOrder Screen Item type and service type document in this i am taking one matrix for item document and one matrix for service document every thing is fine but while adding document I selected Item information (Itemcode and related information) then clicked on ADD button it displaying operation completed successfully. but while using navigation buttons it showing empty information in Item matrix. For Service Document it's working fine what is the reason for this type of cases.
Please give me the solution ASAPHi
please check that your matrix's columns data bound property is set to true.
Thanks -
LoadBatchActions to Populate a Matrix
We have managed to work out some XML that can be passed to LoadBatchActions to populate a matrix in a single call (With performance being the goal), however it doesn't seem possible to populate combo box columns using this mechanism. Is there a way to populate combo box matrix cells with data using LoadBatchActions? What we have so far is something like this, but the LnType2 column is causing the operation to fail because it is a combo box column:
<?xml version="1.0" encoding="UTF-16"?>
<Application>
<forms>
<action type="update">
<form appformnumber="2000071350" uid="FSE_0000000">
<items>
<action type="update">
<Item uid="Matrix">
<Specific>
<rows>
<action type="add">
<row index="0" />
<row index="0" />
</action>
<action type="update">
<row index="1">
<column uid="Um2" string="EA" />
<column uid="LnType2" string="P" />
</row>
<row index="2">
<column uid="Um2" string="EA" />
<column uid="LnType2" string="P" />
</row>
</rows>
</Specific>
</Item>
</action>
</items>
</form>
</action>
</forms>
</Application>Hi Benjamin,
In the Business One UI API 2004 help file you could find an issue named "Adding Forms with XML" where it is explained the file format.
Moreless, you should use the valid values property under ItemSpecific tag to set the possible options, and then add some datasources to link the controls on the matrix with the tables in the DB.
Regards
Ibai Peñ -
I need to create a sparse matrix implementation. Only allocate space for non-zero matrix elements. Implement methods for addition, subtraction, multiplication and determinant. Here is how I want to implement it:
Matrix is an array of linked lists.
Each linked list represents a row.
Each entry in the linked list has a value and a column associated with it.
I need help with the setEntry method and creating the array of linked lists.
Here is what I have so far:
import java.io.*;
import java.util.*;
public class Matrix
private int numberOfRows;
int numberOfColumns;
private IntegerNode[][] entries;
private IntegerNode head = null;
private static BufferedReader stdin = new BufferedReader(
new InputStreamReader( System.in ) );
// Constructor
public Matrix(int numberOfRows, int numberOfColumns)
if (numberOfRows <= 0)
throw new IllegalArgumentException("Cannot construct Matrix with " +
numberOfRows + " rows. Number of rows must be positive.");
if (numberOfColumns <= 0)
throw new IllegalArgumentException("Cannot construct Matrix with " +
numberOfColumns + " columns. Number of columns must be positive.");
entries = new IntegerNode[numberOfRows][numberOfColumns];
this.numberOfRows = numberOfRows;
this.numberOfColumns = numberOfColumns;
public static void main (String [] args) throws IOException {
File myFile1 = getFileName();
Matrix myMatrix1 = Matrix.readMatrixFromFile(myFile1, "Matrix 1");
File myFile2 = getFileName();
Matrix myMatrix2 = Matrix.readMatrixFromFile(myFile2, "Matrix 2");
System.out.println();
System.out.println("Printing out Matrix 1");
System.out.println("---------------------");
myMatrix1.print();
System.out.println("Printing out Matrix 2");
System.out.println("---------------------");
myMatrix2.print();
String myOperation = getAction();
Matrix.performActionOnMatrices(myMatrix1, myMatrix2, myOperation);
public static Matrix readMatrixFromFile(File file, String fname)
throws IOException
BufferedReader reader =
new BufferedReader(new FileReader(file));
// first line should be number of rows followed by number of columns
String line = reader.readLine();
if (line == null)
throw new IOException("File \"" + file + "\" is empty.");
int[] dimensions = readInts(line, 2);
System.out.println("The dimensions of " + fname + " are " + dimensions[0] + " by " +
dimensions[1] + ".");
Matrix matrix = new Matrix(dimensions[0], dimensions[1]);
for (int row = 0; row < dimensions[0]; ++row) {
line = reader.readLine();
if (line == null)
throw new IOException("Matrix in file should have " + dimensions[0] + " rows.");
int[] rowValues = readInts(line, dimensions[1]);
for (int column = 0; column < dimensions[1]; ++column)
matrix.setEntry(row, column, rowValues[column]);
return matrix;
public static String getAction() throws IOException {
System.out.println("What operation would you like to perform on these matrices? (add, subtract, multiply, or determinant) ... ");
String actionToTake = stdin.readLine();
return actionToTake;
public static File getFileName() throws IOException {
System.out.println( "Please enter the full path and name of a file that contains a valid matrix ... " );
String fname = stdin.readLine();
File someFile = new File(fname);
return someFile;
public static void performActionOnMatrices(Matrix matrix1, Matrix matrix2, String action) {
if ((!action.equals("add")) && (!action.equals("subtract")) && (!action.equals("multiply")) && (!action.equals("determinant"))) {
throw new IllegalArgumentException("The only valid actions are add, subtract, multiply or determinant.");
if (action.equals("add")) {
if ((matrix1.numberOfRows != matrix2.numberOfRows) || (matrix1.numberOfColumns != matrix2.numberOfColumns)) {
throw new IllegalArgumentException("The matrices must contain the same number of rows and columns in order to perform addition on them.");
System.out.println("Performing addition on the two matrices...");
Matrix addMatrix = Matrix.add(matrix1, matrix2);
System.out.println("Here is the sum of the two matrices:");
System.out.println("------------------------------------------");
addMatrix.print();
} else if (action.equals("subtract")) {
if ((matrix1.numberOfRows != matrix2.numberOfRows) || (matrix1.numberOfColumns != matrix2.numberOfColumns)) {
throw new IllegalArgumentException("The matrices must contain the same number of rows and columns in order to perform subtraction on them.");
System.out.println("Performing subtraction on the two matrices...");
Matrix subtractMatrix = Matrix.subtract(matrix1, matrix2);
System.out.println("Here is the result of the subtraction:");
System.out.println("---------------------------------------------");
subtractMatrix.print();
} else if (action.equals("multiply")) {
if ((matrix1.numberOfRows != matrix2.numberOfRows) || (matrix1.numberOfColumns != matrix2.numberOfColumns)) {
throw new IllegalArgumentException("The matrices must contain the same number of rows and columns in order to perform multiplication on them.");
if (matrix1.numberOfRows != matrix2.numberOfColumns) {
throw new IllegalArgumentException("The number of rows in the first Matrix must equal the number of columns in the second for multiplying.");
System.out.println("Performing multiplication on the two matrices...");
Matrix multMatrix = Matrix.multiply(matrix1, matrix2);
System.out.println("Here is the product of the two matrices:");
System.out.println("------------------------------------------");
multMatrix.print();
} else if (action.equals("determinant")) {
int det1 = matrix1.determinant();
System.out.println("Determinant of Matrix 1");
System.out.println("-----------------------");
System.out.println(det1);
System.out.println();
int det2 = matrix2.determinant();
System.out.println("Determinant of Matrix 2");
System.out.println("-----------------------");
System.out.println(det2);
System.out.println();
// Sets the entry in the matrix at the given row & column to
// the given value.
public void setEntry(int row, int column, int value)
if ((row < 0) || (row >= numberOfRows))
throw new IllegalArgumentException("Illegal row index " + row +
". Index should be between 0 and " + (numberOfRows-1));
if ((column < 0) || (column >= numberOfColumns))
throw new IllegalArgumentException("Illegal column index " + column +
". Index should be between 0 and " + (numberOfColumns-1));
//if (value != 0) {
IntegerNode newNode = new IntegerNode();
newNode.setItem(value);
entries[row][column] = newNode;
// Returns the matrix entry at the given row & column
public IntegerNode getEntry(int row, int column)
if ((row < 0) || (row >= numberOfRows))
throw new IllegalArgumentException("Illegal row index " + row +
". Index should be between 0 and " + (numberOfRows-1));
if ((column < 0) || (column >= numberOfColumns))
throw new IllegalArgumentException("Illegal column index " + column +
". Index should be between 0 and " + (numberOfColumns-1));
return entries[row][column];
// A primitive routine to print the matrix. It doesn't do
// anything smart or nice about spacing.
public void print()
for (int row = 0; row < numberOfRows; ++row)
for (int column = 0; column < numberOfColumns; ++column)
if (getEntry(row,column) != null) {
System.out.print(getEntry(row, column).getItem() + " ");
System.out.println();
System.out.println();
public void linkNodesInEachRow()
int counter;
for (int row = 0; row < numberOfRows; ++row)
counter = 0;
for (int column = 0; column < numberOfColumns; ++column)
if (getEntry(row,column) != null) {
counter++;
if (counter == 1) {
head = new IntegerNode();
head.setItem(getEntry(row, column).getItem());
} else {
//System.out.print("ITEM NUMBER " + counter + " = ");
//System.out.println(getEntry(row, column).getItem() + " ");
System.out.println();
System.out.println();
/*for (IntegerNode curr = head; curr != null; curr = curr.getNext()) {
System.out.println(curr.getItem());
// Returns the determinant of the matrix.
// This method checks that the matrix is square and throws
// an exception if not.
public int determinant()
int determinantValue = 0;
int counter;
int plusminus = 1; // start with positive value
// Make sure the matrix is square before proceeding with
// determinant calculation
if (numberOfRows != numberOfColumns)
// should really create a MatrixException type
throw new IllegalArgumentException(
"Cannot compute determinant of non-square (" + numberOfRows +
" by " + numberOfColumns + ") matrix.");
} else {
// the matrix has the same number of rows and columns
if (numberOfColumns == 1)
// the matrix is 1x1 - the determinant is just it's value
return entries[0][0].getItem();
else if (numberOfColumns == 2)
// the matrix is 2x2 - return ad - bc
return entries[0][0].getItem() * entries[1][1].getItem() - entries[0][1].getItem() * entries[1][0].getItem();
else
// the matrix is larger than 2x2
// loop through the columns in the matrix
for (counter = 0; counter < numberOfColumns; counter++)
determinantValue += plusminus * entries[0][counter].getItem() * minor(0, counter).determinant(); // The determinant is the sum of all the n possible signed products formed from the matrix using each row and each column only once for each product. Notice the recursive call using the submatrix.
plusminus *= -1; // switch the plus/minus sign of the multiplier on each iteration through the loop
return determinantValue;
// returns a matrix representing the minor of the matrix
// for the specified row and column
public Matrix minor(int row, int column)
int rowsA;
int rowsB;
int colsA;
int colsB;
// decrease the size of the resultant matrix by 1 row and 1 column
Matrix smallerMatrix = new Matrix (numberOfRows - 1, numberOfColumns - 1);
// scroll through the rows and columns in the original Matrix
// copy all of the values from the original Matrix except the one row and column that were passed in
for (rowsA=0, rowsB=0; rowsA < numberOfRows; rowsA++)
if (rowsA != row)
for (colsA=0, colsB=0; colsA < numberOfColumns; colsA++)
if (colsA != column)
// the current row and column do not match the row and column we wish to remove
// set the values in the appropriate positions of the sub matrix
smallerMatrix.setEntry(rowsB, colsB, entries[rowsA][colsA].getItem());
colsB++;
rowsB++;
return smallerMatrix;
// Used to parse the row of ints provided in the file input to
// this program. Given a string containing at least numberToRead
// ints, it creates and returns an int array contaning those
// ints.
private static int[] readInts(String someInts, int numberToRead)
StringTokenizer tokenizer = new StringTokenizer(someInts);
if (numberToRead < 0)
throw new IllegalArgumentException("Cannot read " + numberToRead
+ " ints. numberToRead must be nonnegative.");
int[] toReturn = new int[numberToRead];
for (int i = 0; i < numberToRead; ++i)
if (!tokenizer.hasMoreTokens())
throw new IllegalArgumentException("Cannot read " + numberToRead +
" ints from string \"" + someInts + "\".");
String token = tokenizer.nextToken();
toReturn[i] = Integer.parseInt(token);
return toReturn;
public static Matrix add (Matrix a, Matrix b)
Matrix result = new Matrix(a.numberOfRows, a.numberOfColumns);
for(int i = 0; i < a.numberOfRows; i++)
for(int j = 0; j < a.numberOfColumns; j++)
int value = a.getEntry(i, j).getItem() + b.getEntry(i, j).getItem();
result.setEntry(i, j, value);
System.out.println("Addition complete.");
return result;
public static Matrix subtract (Matrix a, Matrix b)
Matrix result = new Matrix(a.numberOfRows, a.numberOfColumns);
for(int i = 0; i < a.numberOfRows; i++)
for(int j = 0; j < a.numberOfColumns; j++)
int value = a.getEntry(i, j).getItem() - b.getEntry(i, j).getItem();
result.setEntry(i, j, value);
System.out.println("Subtraction complete.");
return result;
public static Matrix multiply (Matrix a, Matrix b)
Matrix result = new Matrix(a.numberOfRows, b.numberOfColumns);
int colSum = 0;
for(int i = 0; i < a.numberOfRows; i++)
for(int j = 0; j < b.numberOfColumns; j++)
colSum = 0;
for(int k = 0; k < a.numberOfColumns; k++)
colSum += a.getEntry(i,k).getItem() * b.getEntry(k,j).getItem();
result.setEntry(i, j, colSum);
System.out.println("Multiplication complete.");
return result;
public class IntegerNode {
private int item;
private IntegerNode next;
public void setItem(int newItem) {
item = newItem;
public int getItem() {
return item;
public void setNext(IntegerNode nextNode) {
next = nextNode;
public IntegerNode getNext() {
return next;
}Please help. The code runs just fine. The only thing is I need to link the nodes together (for each row) into a linked list and then put each linked list into an array. I need help with setEntry. The details of creating a node, attaching it to the list representing a row, etc. need to be in setEntry. Please help.
For the following matrix:
1 4 5
4 2 5
2 1 2
There is an array of three linked lists.
LinkedListsArray[0] = Entry(value=1, column=0)->Entry(value=4, column=1)->Entry(value=5, column=2)
LinkedListsArray[1] = Entry(value=4, column=0)->Entry(value=2, column=1)->Entry(value=5, column=2)
LinkedListsArray[2] = .....
Each entry is a node in the linked list.
The last twist is that if any values are zero, they shouldn't have nodes associated with them. Don't allocate nodes for zero valued entries. -
Failed pre install check for 11i
Hi, newbie to 11i and am trying to install 11i on my 250GB external HD but failed pre-install checks in 3 areas
1) system utilities check (!)
2) operating system check (!)
3) file space check (x) talked about mount points in error message
Quite frustrating as i had installed the mks and mvs files on my c:\ as instructed. also i was`advised to certain tests thru the cmd prompt by entering these files; link, gnumake and cc. i got responses for link ad gnumake but no respnses for cc.
guys out there, any solutions please
Message was edited by:
user480131Saw the same post at other place too..
While running rapid install did you give the mount points for Data_top ora_top and Appl_top to correct values
For system utils check for the PATH env variable is it pointing to right place.
For OS check .. I am not sure. (you should have checked the certiifcation matrix for this .. or may be some required patches are missing for this OS)
Hi, newbie to 11i and am trying to install 11i on my
250GB external HD but failed pre-install checks in 3
areas
1) system utilities check (!)
2) operating system check (!)
3) file space check (x) talked about mount points in
error message
Quite frustrating as i had installed the mks and mvs
files on my c:\ as instructed. also i was`advised to
certain tests thru the cmd prompt by entering these
files; link, gnumake and cc. i got responses for link
ad gnumake but no respnses for cc.
guys out there, any solutions please
Message was edited by:
user480131Saw same post at another place too ..
Maybe you are looking for
-
Importing existing MP3 files from my My Music folder to iTunes
I added a bunch of music from cd to my My Music folder using WMP. How can I get the iTunes program to import all of the music (60 or 70 cds worth) and convert it without having to do it one song at a time? Didn't it do the same thing the first time I
-
How to create Multiple Selection Screen in ALV
Hi, Can anybody tell me how to create the Multiple Selection screen in ALV reports. Plse give me code sample if possible. Thanks in advance KP
-
Need to refresh Quality DB from its Production DB
Hi Forum , We have Production Oracle 11.2.0.3.0 Database and also have Quality DB with same version 11.2.0.3.0 . Both the Database's are available in different machines with different SID. Like: Production SID: EBP Quality SID: EQP OS: AIX Customer:
-
External isight camera with imovie on maverick?
Can someone please recommend an external iSight (or other) Camera to use which can record video directly into iMove on Maverick? When trying to import a video, a drop down window shows the built-in iSight camera, as if options could possibly be avai
-
This is starting to **** me off...first I have to redo all my movies all over again since I got imovie '08, now it won't import my movies. I have files on my external drive in a .mov file trying to import into imovie. never a problem with version 5 o