on 09-30-2008 6:13 AM
Hi to All,
How to fill the Matrix with data ,.Data will retrive from SQLSERVER Table
Hi
This is a working example.
I'm loading the matrix form from an xml file.
Hope this help you.
Regards
Sierdna S.
<Application>
<forms>
<action type="add">
<form FormType="O99_ASU" type="4" BorderStyle="0" uid="TO_CHANGE"
title="Lista Articoli (Carico/Scarico Magazzino Verticale)"
visible="1" default_button="1" pane="0" color="0"
left="200" top="100" width="900" height="540"
client_width="900" client_height="540"
modal="1"
AutoManaged="1" SupportedModes="15" ObjectType="-1" mode="1">
<datasources>
<dbdatasources>
<action type="add">
<datasource tablename="RDR1"></datasource>
<datasource tablename="OITM"></datasource>
</action>
</dbdatasources>
<userdatasources>
<action type="add">
<!-- 0. Nr.riga -->
<datasource uid="uNr" type="9" size="20"></datasource>
<!-- 1. Seleziona/Deseleziona -->
<datasource uid="uChoise" type="9" size="20"></datasource>
<!-- 2 Inserita/Non Inserita -->
<datasource uid="uStatoIns" type="9" size="20"></datasource>
<!-- 3. Numero Documento -->
<datasource uid="uDocNum" type="9" size="20"></datasource>
<!-- 4. Doc.Entry -->
<datasource uid="uDocEntry" type="9" size="20"></datasource>
<!-- 5. Numero Riga -->
<datasource uid="uLineNum" type="9" size="20"></datasource>
<!-- 6. Dati LP -->
<datasource uid="uPickNum" type="9" size="20"></datasource>
<!-- 7,8,9. Dati Articolo: Code, Name, Qta Ordinata -->
<datasource uid="uItemCode" type="9" size="20"></datasource>
<datasource uid="uItemName" type="9" size="150"></datasource>
<datasource uid="uQuantita" type="2" size="19"></datasource>
<!-- 10,11. Dati Magazzino: Code, Name -->
<datasource uid="uMagazzin" type="9" size="20"></datasource>
<datasource uid="uMagazDes" type="9" size="100"></datasource>
<!-- 12. Giacenza Magazzino -->
<datasource uid="uGiacenza" type="2" size="19"></datasource>
<!-- 13. Disponibilita' Magazzino -->
<datasource uid="uDisponib" type="2" size="19"></datasource>
<!-- 14. Causale Magazzino -->
<datasource uid="uCausale" type="9" size="30"></datasource>
<!-- 15. Note testata -->
<datasource uid="uNote" type="9" size="250"></datasource>
<!-- 16. Flag Magazzino Verticale 'ICAM' uFMagVert -->
<datasource uid="uFMagVert" type="9" size="20"></datasource>
<!-- 17. ID Elaborazione ICAM -->
<datasource uid="uICAM" type="9" size="30"></datasource>
<!-- 18. Note Riga Movimento ICAM -->
<datasource uid="uNoteICAM" type="9" size="250"></datasource>
</action>
</userdatasources>
</datasources>
<items>
<action type="add">
<!-- RIEMPIMENTO MATRICE -->
<!-- ============================================= -->
<!-- MATRIX -->
<!-- ============================================= -->
<item uid="mtx00" type="127" tab_order="10" description=""
left="10" top="10" width="770" height="440"
visible="1" enabled="1" from_pane="0" to_pane="0" disp_desc="0" right_just="0"
linkto="" forecolor="-1" backcolor="-1" text_style="0" font_size="-1" supp_zeros="0"
AffectsFormMode="1">
<AutoManagedAttribute></AutoManagedAttribute>
<specific layout="0" titleHeight="16" cellHeight="16">
<columns>
<action type="add">
<!-- ==================================================== -->
<!-- MATRIX: ATTRIBUTES -->
<!-- ==================================================== -->
<!-- MATRIX: ATTRIBUTE 0: Line Number -->
<column uid="eNR" type="16" title="#" description="Numero riga documento" visible="1"
AffectsFormMode="0" width="20" disp_desc="0"
editable="0" right_just="0" val_on="" val_off=""
backcolor="-1" forecolor="-1"
text_style="0" font_size="-1">
<databind databound="1" table="" alias="uNr"></databind>
<ExtendedObject></ExtendedObject>
</column>
<!-- MATRIX: ATTRIBUTE 1: Seleziona/Deseleziona : 16711382 -->
<column uid="eChoise" type="121" title="Scegli/Scarta" description="Scegli/Scarta"
editable="1" val_on="1" val_off="0" visible="1"
AffectsFormMode="1" width="20" disp_desc="0"
right_just="0"
backcolor="14483164" forecolor="-1"
text_style="0" font_size="-1">
<databind databound="1" table="" alias="uChoise"></databind>
<ExtendedObject></ExtendedObject>
</column>
<!-- MATRIX: ATTRIBUTE 2: Inserita/Non Inserita : 12837118 -->
<column uid="eStatoIns" type="121" title="Stato inserimento" description="Inserita/Non Inserita"
editable="0" val_on="1" val_off="0" visible="1"
AffectsFormMode="1" width="20" disp_desc="0"
right_just="0"
backcolor="12837118" forecolor="-1"
text_style="0" font_size="-1">
<databind databound="1" table="" alias="uStatoIns"></databind>
<ExtendedObject></ExtendedObject>
</column>
<!-- MATRIX: ATTRIBUTE 3: N.Documento -->
<column uid="eDocNum" type="16" title="N.documento" description="Numero Documento"
visible="1"
AffectsFormMode="0" width="20" disp_desc="0"
editable="0" right_just="0" val_on="" val_off=""
backcolor="-1" forecolor="-1"
text_style="0" font_size="-1">
<databind databound="1" table="" alias="uDocNum"></databind>
<ExtendedObject></ExtendedObject>
</column>
<!-- MATRIX: ATTRIBUTE 4: Numero Documento -->
<column uid="eDocEntry" type="116" title="Rif.Documento" description="Rif.Documento"
visible="1"
AffectsFormMode="0" width="20" disp_desc="0"
editable="0" right_just="0" val_on="" val_off=""
backcolor="-1" forecolor="-1"
text_style="0" font_size="-1">
<databind databound="1" table="" alias="uDocEntry"></databind>
<ExtendedObject linkedObject="17" LinkedObjectType="17"></ExtendedObject>
</column>
<!-- MATRIX: ATTRIBUTE 5: Riga Documento -->
<column uid="eLineNum" type="16" title="R.documento" description="Numero riga documento"
visible="1"
AffectsFormMode="0" width="20" disp_desc="0"
editable="0" right_just="0" val_on="" val_off=""
backcolor="-1" forecolor="-1"
text_style="0" font_size="-1">
<databind databound="1" table="" alias="uLineNum"></databind>
<ExtendedObject></ExtendedObject>
</column>
<!-- MATRIX: ATTRIBUTE 6: Pick Number -->
<column uid="ePickNum" type="16" title="Pick Number" description="Pick Number"
visible="0"
AffectsFormMode="0" width="20" disp_desc="0"
editable="0" right_just="0" val_on="" val_off=""
backcolor="-1" forecolor="-1"
text_style="0" font_size="-1">
<databind databound="1" table="" alias="uPickNum"></databind>
<ExtendedObject></ExtendedObject>
</column>
<!-- MATRIX: ATTRIBUTE 7: ItemCode -->
<column uid="eItemCode" type="116" title="Codice Articolo" description="Codice Articolo"
visible="1" AffectsFormMode="0" width="20" disp_desc="0" editable="0"
right_just="0" val_on="" val_off="" backcolor="-1" forecolor="-1"
text_style="0" font_size="-1">
<databind databound="1" table="" alias="uItemCode"></databind>
<ExtendedObject linkedObject="4" LinkedObjectType="4"></ExtendedObject>
</column>
<!-- MATRIX: ATTRIBUTE 8: ItemName -->
<column uid="eItemName" type="16" title="Descrizione Articolo" description="Descrizione Articolo"
visible="1" AffectsFormMode="0" width="200" disp_desc="0" editable="0"
right_just="0" val_on="" val_off="" backcolor="-1" forecolor="-1"
text_style="0" font_size="-1">
<databind databound="1" table="" alias="uItemName"></databind>
<ExtendedObject></ExtendedObject>
</column>
<!-- MATRIX: ATTRIBUTE 9: Quantità Ordinata -->
<column uid="eQuantita" type="16" title="Quantità Ordinata" description="Quantità Ordinata"
visible="1" AffectsFormMode="0" width="50" disp_desc="0"
editable="0" right_just="0" val_on="" val_off="" backcolor="-1"
forecolor="-1" text_style="0" font_size="-1">
<databind databound="1" table="" alias="uQuantita"></databind>
<ExtendedObject></ExtendedObject>
</column>
<!-- MATRIX: ATTRIBUTE 10: WshCode, Magazzino -->
<column uid="eMagazzin" type="116" title="Cod.Magazzino" description="Codice Magazzino"
visible="1" AffectsFormMode="0" width="20" disp_desc="0" editable="0"
right_just="0" val_on="" val_off="" backcolor="-1" forecolor="-1"
text_style="0" font_size="-1">
<databind databound="1" table="" alias="uMagazzin"></databind>
<ExtendedObject linkedObject="64" LinkedObjectType="64"></ExtendedObject>
</column>
<!-- MATRIX: ATTRIBUTE 11: WshName, Descrizione Magazzino -->
<column uid="eMagazDes" type="16" title="Descrizione Magazzino" description="Descrizione Magazzino"
visible="1" AffectsFormMode="0" width="150" disp_desc="0" editable="0"
right_just="0" val_on="" val_off="" backcolor="-1" forecolor="-1"
text_style="0" font_size="-1">
<databind databound="1" table="" alias="uMagazDes"></databind>
<ExtendedObject></ExtendedObject>
</column>
<!-- MATRIX: ATTRIBUTE 12: Giacenza Magazzino -->
<column uid="eGiacenza" type="16" title="Giacenza Magazzino" description="Giacenza Magazzino"
visible="1" AffectsFormMode="0" width="50" disp_desc="0"
editable="0" right_just="0" val_on="" val_off="" backcolor="-1"
forecolor="-1" text_style="0" font_size="-1">
<databind databound="1" table="" alias="uGiacenza"></databind>
<ExtendedObject></ExtendedObject>
</column>
<!-- MATRIX: ATTRIBUTE 13: Disponibilita' Magazzino -->
<column uid="eDisponib" type="16" title="Disponibilita' Magazzino" description="Disponibilita' Magazzino"
visible="1" AffectsFormMode="0" width="50" disp_desc="0"
editable="0" right_just="0" val_on="" val_off="" backcolor="-1"
forecolor="-1" text_style="0" font_size="-1">
<databind databound="1" table="" alias="uDisponib"></databind>
<ExtendedObject></ExtendedObject>
</column>
<!-- MATRIX: ATTRIBUTE 14: O01_CAUMAGVERT.Code, Causale Magazzino : DEVE ESSERE un ComboBox con type=13 e disp_desc=1 -->
<column uid="eCausale" type="16" title="Causale" description="Causale"
visible="1" AffectsFormMode="0" width="30" disp_desc="0" editable="0"
right_just="0" val_on="" val_off="" backcolor="-1" forecolor="-1"
text_style="0" font_size="-1">
<databind databound="1" table="" alias="uCausale"></databind>
<ExtendedObject></ExtendedObject>
</column>
<!-- MATRIX: ATTRIBUTE 15: ORDR.Comments, Note testata ordine -->
<column uid="eNote" type="16" title="Note" description="Note"
visible="0" AffectsFormMode="0" width="30" disp_desc="0" editable="0"
right_just="0" val_on="" val_off="" backcolor="-1" forecolor="-1"
text_style="0" font_size="-1">
<databind databound="1" table="" alias="uNote"></databind>
<ExtendedObject></ExtendedObject>
</column>
<!-- MATRIX: ATTRIBUTE 16: Flag Magazzino Veticale (da Anagrafica Articoli) -->
<column uid="eFMagVert" type="121" title="Flag Mag.Vertcale"
description="Flag Magazzino Veticale (da Anagrafica Articoli)"
editable="0" val_on="Y" val_off="N" visible="1"
AffectsFormMode="1" width="20" disp_desc="0"
right_just="0"
backcolor="-1" forecolor="-1"
text_style="0" font_size="-1">
<databind databound="1" table="" alias="uFMagVert"></databind>
<ExtendedObject></ExtendedObject>
</column>
<!-- MATRIX: ATTRIBUTE 17: ID Elaborazione ICAM -->
<column uid="eICAM" type="16" title="ID ICAM" description="ID Elaborazione ICAM (CodiceTestata_NumRiga)"
visible="1" AffectsFormMode="0" width="30" disp_desc="0" editable="0"
right_just="0" val_on="" val_off="" backcolor="-1" forecolor="-1"
text_style="0" font_size="-1">
<databind databound="1" table="" alias="uICAM"></databind>
<ExtendedObject></ExtendedObject>
</column>
<!-- MATRIX: ATTRIBUTE 18: Note riga movimento per ICAM -->
<column uid="eNoteICAM" type="16" title="Note per Mag.Verticale ICAM" description="Note per Mag.Verticale ICAM"
visible="1" AffectsFormMode="0" width="30" disp_desc="0" editable="1"
right_just="0" val_on="" val_off="" backcolor="-1" forecolor="-1"
text_style="0" font_size="-1">
<databind databound="1" table="" alias="uNoteICAM"></databind>
<ExtendedObject></ExtendedObject>
</column>
</action>
</columns>
</specific>
</item>
<!-- =========================================================== -->
<!-- BUTTONS -->
<!-- =========================================================== -->
<!-- Button: Go Back, Indietro a criteri di selezione -->
<item uid="btnGoBack" type="4" left="10" tab_order="15"
width="32" top="450" height="32" visible="1" enabled="1"
from_pane="0" to_pane="0" disp_desc="0" right_just="0"
description="Indietro a criteri di selezione" linkto=""
forecolor="-1" backcolor="-1" text_style="0" font_size="-1"
supp_zeros="0" AffectsFormMode="1">
<AutoManagedAttribute></AutoManagedAttribute>
<specific image="Go Back Icon"></specific>
</item>
<!-- Button: Ok, Conferma operazione -->
<item uid="btnConf" type="4" description="Conferma operazione" tab_order="20"
left="50" top="455" width="85" height="19" visible="1"
enabled="1" from_pane="0" to_pane="0" disp_desc="0" right_just="0"
linkto="" forecolor="-1" backcolor="-1" text_style="0" font_size="-1"
supp_zeros="0" AffectsFormMode="1">
<AutoManagedAttribute></AutoManagedAttribute><specific caption="Conferma"></specific>
</item>
<!-- Button: Interrompi, Annulla operazione -->
<item uid="2" type="4" description="Annulla operazione" tab_order="30"
left="136" top="455" width="85" height="19" visible="1"
enabled="1" from_pane="0" to_pane="0" disp_desc="0" right_just="0"
linkto="" forecolor="-1" backcolor="-1" text_style="0" font_size="-1"
supp_zeros="0" AffectsFormMode="1">
<AutoManagedAttribute></AutoManagedAttribute><specific caption="Interrompi"></specific>
</item>
<!-- Button: Stampa, Stampa contenuto della tabella -->
<item uid="stpTab" type="4" description="Stampa contenuto della tabella" tab_order="33"
left="222" top="455" width="85" height="19" visible="1"
enabled="0" from_pane="0" to_pane="0" disp_desc="0" right_just="0"
linkto="" forecolor="-1" backcolor="-1" text_style="0" font_size="-1"
supp_zeros="0" AffectsFormMode="1">
<AutoManagedAttribute></AutoManagedAttribute><specific caption="Stampa"></specific>
</item>
<!-- Button: Log, File di log di operazione corrente -->
<item uid="btnLog" type="4" description="Visualizza file di log" tab_order="35"
left="308" top="455" width="85" height="19" visible="1"
enabled="1" from_pane="0" to_pane="0" disp_desc="0" right_just="0"
linkto="" forecolor="-1" backcolor="-1" text_style="0" font_size="-1"
supp_zeros="0" AffectsFormMode="1">
<AutoManagedAttribute></AutoManagedAttribute><specific caption="Log"></specific>
</item>
<!-- Button: Seleziona tutto, Seleziona tutte le righe -->
<item uid="selAll" type="4" description="Seleziona tutte le righe" tab_order="40"
left="790" top="10" width="85" height="19" visible="1"
enabled="1" from_pane="0" to_pane="0" disp_desc="0" right_just="0"
linkto="" forecolor="-1" backcolor="-1" text_style="0" font_size="-1"
supp_zeros="0" AffectsFormMode="1">
<AutoManagedAttribute></AutoManagedAttribute><specific caption="Seleziona tutto"></specific>
</item>
<!-- Button: Deseleziona tutto, Deseleziona tutte le righe -->
<item uid="desAll" type="4" description="Deseleziona tutte le righe" tab_order="50"
left="790" top="35" width="85" height="19" visible="1"
enabled="1" from_pane="0" to_pane="0" disp_desc="0" right_just="0"
linkto="" forecolor="-1" backcolor="-1" text_style="0" font_size="-1"
supp_zeros="0" AffectsFormMode="1">
<AutoManagedAttribute></AutoManagedAttribute><specific caption="Deseleziona tutto"></specific>
</item>
</action>
</items>
<FormMenu></FormMenu>
<DataBrowser></DataBrowser>
<!-- <Settings Enabled="1" MatrixUID="mtx00" EnableRowFormat="1" /> -->
</form>
</action>
</forms>
</Application>
Code to fill the matrix:
Private Sub Matrix_Fill( _
ByRef oForm As SAPbouiCOM.Form, _
ByVal sSourceFormTypeEx As String _
)
Dim oMatrix As SAPbouiCOM.Matrix
oMatrix = oForm.Items.Item("mtx00").Specific
oMatrix.SelectionMode = SAPbouiCOM.BoMatrixSelect.ms_Single
oMatrix.Clear()
Dim oRS As SAPbobsCOM.Recordset
Dim sSql As String = ""
Try
' ++++++++++++++++++++++
' Ordine Cliente: ORDR +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
' ++++++++++++++++++++++
sSql = " SELECT R.DocEntry, " & _
" R.LineNum As LineNum, " & _
" R.ItemCode As ItemCode, " & _
" R.Dscription As ItemName, " & _
" R.Quantity As Quantita, " & _
" R.U_O99_MVRNOT As NoteICAM, " & _
" R.WhsCode As WhsCode, " & _
" W.WhsName As WhsName, " & _
" I.U_O99_MagVert As FMagVert, " & _
" COALESCE(T.OnHand,0) AS Giacenza, " & _
" (COALESCE(T.OnHand,0) - COALESCE(T.IsCommited,0) + COALESCE(T.OnOrder,0)) AS Disponibilita, " & _
" COALESCE(C.Name,'') As Causale, " & _
" COALESCE(O.Comments,'') As Note " & _
" FROM ORDR AS O, " & _
" OITM AS I, " & _
" RDR1 AS R " & _
" LEFT OUTER JOIN OWHS AS W ON W.WhsCode = R.WhsCode " & _
" LEFT OUTER JOIN OITW AS T ON (T.WhsCode = R.WhsCode AND T.ItemCode = R.ItemCode)" & _
" LEFT OUTER JOIN [@O99_CAUMAGVERT] AS C ON C.Code = R.U_O99_CauVert " & _
" WHERE COALESCE(R.U_O99_MagVert,'N') = 'Y' " & _
" AND O.DocEntry = R.DocEntry " & _
" AND O.DocNum = " & glo_id & _
" AND COALESCE(R.U_O99_RigaMov,' ') = ' ' " & _
" AND R.ItemCode = I.ItemCode" & _
" ORDER BY 5, 2 "
oRS = SBO_Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
oRS.DoQuery(sSql)
Dim conta As Integer = oRS.RecordCount
If conta > 0 Then
Dim i As Integer = 0
oRS.MoveFirst()
glo_iDocEntry = oRS.Fields.Item("DocEntry").Value()
While oRS.EoF = False
i = i + 1
oForm.DataSources.UserDataSources.Item("uNr").Value = i
oForm.DataSources.UserDataSources.Item("uLineNum").Value = oRS.Fields.Item("LineNum").Value
oForm.DataSources.UserDataSources.Item("uChoise").Value = "1"
oForm.DataSources.UserDataSources.Item("uStatoIns").Value = "0"
oForm.DataSources.UserDataSources.Item("uItemCode").Value = oRS.Fields.Item("ItemCode").Value
oForm.DataSources.UserDataSources.Item("uItemName").Value = oRS.Fields.Item("ItemName").Value
oForm.DataSources.UserDataSources.Item("uDocEntry").Value = oRS.Fields.Item("DocEntry").Value
oForm.DataSources.UserDataSources.Item("uDocNum").Value = glo_id
oForm.DataSources.UserDataSources.Item("uQuantita").Value = oRS.Fields.Item("Quantita").Value
oForm.DataSources.UserDataSources.Item("uMagazzin").Value = oRS.Fields.Item("WhsCode").Value
oForm.DataSources.UserDataSources.Item("uMagazDes").Value = oRS.Fields.Item("WhsName").Value
oForm.DataSources.UserDataSources.Item("uGiacenza").Value = oRS.Fields.Item("Giacenza").Value
oForm.DataSources.UserDataSources.Item("uDisponib").Value = oRS.Fields.Item("Disponibilita").Value
oForm.DataSources.UserDataSources.Item("uCausale").Value = oRS.Fields.Item("Causale").Value
oForm.DataSources.UserDataSources.Item("uNote").Value = oRS.Fields.Item("Note").Value
oForm.DataSources.UserDataSources.Item("uNoteICAM").Value = oRS.Fields.Item("NoteICAM").Value
Dim flag As String = oRS.Fields.Item("FMagVert").Value
If Not flag.Equals("Y") Then glo_NoFlag += 1
oForm.DataSources.UserDataSources.Item("uFMagVert").Value = flag
oMatrix.AddRow()
oRS.MoveNext()
End While
Try
oMatrix.Columns.Item("eDocEntry").Visible = False
Catch ex As Exception
' log exception
Finally
End Try
End If
oMatrix.Columns.Item("eICAM").Visible = False
Catch ex As Exception
Dim s As String = "ERROR: " & ex.Message
SBO_Log.WriteLog("Matrix_Fill", s)
SBO_Application.StatusBar.SetText(s, BoMessageTime.bmt_Long, BoStatusBarMessageType.smt_Error)
Finally
oMatrix.AutoResizeColumns()
If oMatrix.VisualRowCount = 0 Then
oForm.Items.Item("btnConf").Enabled = False
oForm.Items.Item("mtx00").Enabled = False
End If
If Not oRS Is Nothing Then
System.Runtime.InteropServices.Marshal.ReleaseComObject(oRS)
oRS = Nothing
End If
System.GC.Collect() 'Release the handle to the table
oMatrix = Nothing
End Try
End Sub
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Thippa Reddy Musturu
If your problem is solved close the thread
Regards
Sierdna S.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Thipa,
If all data source of the matrix is from DB, I will suggest you to use Grid instead of Matrix. Simple to use , Better performance, and also powful collapse funciton. You may refer to <<C:\Program Files\SAP\SAP Business One SDK\Samples\COM UI\VB.NET\19.Grid>>
Kind Regards
-Yatsea
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi..
see this example program..
C:\Program Files\SAP\SAP Business One SDK\Samples\COM UI\VB.NET\06.MatrixAndDataSources\2003
Regards..
Billa 2007
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
99 | |
11 | |
11 | |
6 | |
6 | |
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.