Fill matrix with query
Hi,
I have a query that I want to display in a matrix. The query is based on the tables: OINV, INV1, OITM, OCRD. I would like to know what is the best way to bind this query to a matrix? Should I create a recordset with the query and iterate it and fill the matrix line by line and column by columns, or can I use something like a datasource with query (even if there are more than one table) and bind it?
And also, can I create this query using the DI API (I haven't worked with it so far) or do I have to create it myself (my own SELECT)?
Thank you so much,
Irina
hi,
create one temporary table called TEMP with all necessary fields which u r going to insert in Matrix.
Use the following code.
delete the existing values in @TEMP table
RS = Nothing
RS = ocompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
RS.DoQuery("Select * from OITM,OITW,ITT1 where Conditions")
For i as integer = 1 To RS.RecordCount
RS1 = Nothing
RS1 = ocompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
RS1.DoQuery("INSERT INTO [@TEMP](DocEntry,U_X,U_Y,U_Z)values(" & i & "," & RS.Fields.Item("ItemCode").Value & "','" & RS.Fields.Item("Quantity").Value & "','" & RS.Fields.Item("UoM").Value & "')")
End If
DSource = Nothing
oMatrix = oForm.Items.Item("MatrixUID").Specific
oColumns = oMatrix.Columns
DSource = oForm.DataSources.DBDataSources.Add("@TEMP")
oColumn = oColumns.Item("0") ' # Column
oColumn.DataBind.SetBound(True, "@TEMP", "DocEntry")
oColumn = oColumns.Item("1")
oColumn.DataBind.SetBound(True, "@TEMP", "U_X")
oColumn = oColumns.Item("2")
oColumn.DataBind.SetBound(True, "@TEMP", "U_Y")
oColumn = oColumns.Item("3")
oColumn.DataBind.SetBound(True, "@TEMP", "U_Z")
oMatrix.Clear()
oMatrix.AutoResizeColumns()
DSource.Query()
oMatrix.LoadFromDataSource()
or u can use a virtual data source table.this is better.
oForm.DataSources.DataTables.Add("TEMP") 'Virtual data table. You can use as is.
Dim SQLSTR as String = "SELECT fields FROM tables WHERE Conditions"
oForm.DataSources.DataTables.Item("TEMP").ExecuteQuery(SQLSTR )
DSource = Nothing
oMatrix = oForm.Items.Item("MatrixUID").Specific
oColumns = oMatrix.Columns
oColumn = oColumns.Item("1")
oColumn.DataBind.SetBound(True, "TEMP", "U_X")
oColumn = oColumns.Item("2")
oColumn.DataBind.SetBound(True, "TEMP", "U_Y")
oColumn = oColumns.Item("3")
oColumn.DataBind.SetBound(True, "TEMP", "U_Z")
oMatrix.Clear()
oMatrix.AutoResizeColumns()
DSource.Query()
oMatrix.LoadFromDataSource()
regards,
varma
Edited by: Varma on Oct 18, 2008 9:53 AM
Similar Messages
-
How to fill matrix with the output of recordset query?
Hi all,
I want a user matrix to load data when I hit a button and the data to be filled is the output of an sql query. binding the matrix columns with table columns and then load the matrix with DBDatasource attached to that table will not do in this case as the columns in the sql query are from several different tables or views.
writing following line to do this takes several minutes to load the data:
For j = 0 To Reordset.RecordCount - 1
Matrix.AddRow()
Matrix.Columns.Item("col1").Cells.Item(i).Specific.value = Recordset.Fields.Item("cardcode").Value
Recordset.movenext()
next
Is there any other way to fill the matrix in this case, which loads the data faster?
Regards,Hello Binita,
I've tested the CFL for DataTable-Matrixes in my test-AddOn. But there's still one problem left. Maybe you find it out (I will need this in the future too...).
The ChooseFromList must be added behind the DataTable-Bind, which is done on every MTX-Load (it's not from the sample above, so the UIDs are new ones):
oDt = oDts.Item("dt_test")
query = "SELECT * FROM [@T_CONVTOOLS01]"
oDt.ExecuteQuery(query)
oMtx.Columns.Item("0").DataBind.Bind("dt_test", "Code")
oMtx.Columns.Item("1").DataBind.Bind("dt_test", "U_Alpha01")
oMtx.Columns.Item("2").DataBind.Bind("dt_test", "U_Price01")
oMtx.Columns.Item("3").DataBind.Bind("dt_test", "U_Quant01")
oMtx.Columns.Item("4").DataBind.Bind("dt_test", "U_Date01")
AddChooseFromLists()
oMtx.LoadFromDataSource()
...where AddChooseFromLists() is...
Private Shared Sub AddChooseFromLists()
Try
Dim oCfls As SAPbouiCOM.ChooseFromListCollection
Dim oCons As SAPbouiCOM.Conditions
Dim oCon As SAPbouiCOM.Condition
Dim oCfl As SAPbouiCOM.ChooseFromList
Dim oCflCreationParams As SAPbouiCOM.ChooseFromListCreationParams
Dim oBtn As SAPbouiCOM.Button
Dim oMtx As SAPbouiCOM.Matrix
Dim oCol As SAPbouiCOM.Column
Dim oEtx As SAPbouiCOM.EditText
oMtx = oForm.Items.Item("MTX_TEST02").Specific
oCfls = oForm.ChooseFromLists
oCflCreationParams = SboCon.SboUI.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_ChooseFromListCreationParams)
oCflCreationParams.MultiSelection = False
oCflCreationParams.ObjectType = SAPbouiCOM.BoLinkedObject.lf_BusinessPartner
oCflCreationParams.UniqueID = "CFL_C1"
oCfl = oCfls.Add(oCflCreationParams)
'### OPTION:
'# Shown ChooseFromList restricted by Conditions
oCons = oCfl.GetConditions()
oCon = oCons.Add()
oCon.Alias = "CardType"
oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL
oCon.CondVal = "C"
oCfl.SetConditions(oCons)
oCol = oMtx.Columns.Item("1")
oCol.ChooseFromListUID = "CFL_C1"
oCol.ChooseFromListAlias = "CardCode"
Catch e As Exception
Microsoft.VisualBasic.MsgBox(className & ".AddChooseFromLists()" & vbCrLf & "Exception:" & vbCrLf & e.Message.ToString)
End Try
End Sub
But I'm running into problems when trying to set the MTX-Cell via DataTable at the CFL-Event (see comment):
If pVal.EventType = SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST Then
Dim oMtx As SAPbouiCOM.Matrix
Dim oCFLEvent As SAPbouiCOM.IChooseFromListEvent
Dim oCFL As SAPbouiCOM.ChooseFromList
Dim oDataTable As SAPbouiCOM.DataTable
Dim cflID As String
Dim oDt As SAPbouiCOM.DataTable = oForm.DataSources.DataTables.Item("dt_test")
oCFLEvent = pVal
cflID = oCFLEvent.ChooseFromListUID
'Dim oForm As SAPbouiCOM.Form
'oForm = SboConnection.SboUI.Forms.Item(FormUID)
oCFL = oForm.ChooseFromLists.Item(cflID)
If Not oCFLEvent.BeforeAction Then
oDataTable = oCFLEvent.SelectedObjects
If oDataTable Is Nothing Then Exit Sub
'############## Matrix Test #######################################################################
If (oCFLEvent.ItemUID = "MTX_TEST02") Then
oMtx = oForm.Items.Item("MTX_TEST02").Specific
'### CFL Results to UserForm
oDt.Rows.Offset = oCFLEvent.Row - 1
MsgBox(oDt.GetValue("U_Alpha01", oCFLEvent.Row - 1))
MsgBox(oDataTable.GetValue("CardCode", 0))
' PROBLEM - can't get this working - don't know at the moment:
' on other forms SetValue works....
oDt.SetValue("U_Alpha01", oCFLEvent.Row - 1, oDataTable.GetValue("CardCode", 0))
' this also gives me problems...:
'oMtx.Columns.Item("1").Cells.Item(oCFLEvent.Row).Specific.value = oDataTable.GetValue("CardCode", 0)
oForm.Update()
End If
End If
End If
The CFL-Form opens and returns the choosen value(s) at the CFL-event. But writing to MTX still not works with this code...
Maybe you find the last piece. If so: please write here.
Cheers,
Roland
p.s.:
David Nussböck wrote
LOL - ROLAND WAS FASTER ))
...just one minute... -
Filling matrix with Dummy Data
I am doing a demo screen for a client and I need to fill a matrix with hard coded data. I followed the sample code and I have the following code but it is not working for me (it throws a matrix-line exists exception):
// Now get the matrix Item.
SAPbouiCOM.Item matrixItem = oForm.Items.Item("v33_Grid");
theMatrix = (SAPbouiCOM.Matrix) matrixItem.Specific;
Form.Freeze(true);
SAPbouiCOM.UserDataSource uds;
uds = oForm.DataSources.UserDataSources.Add("salesUds",SAPbouiCOM.BoDataType.dt_SHORT_TEXT, 10);
theMatrix.AddRow(1, theMatrix.RowCount);
SAPbouiCOM.Column col = null;
// Ready Matrix to populate data
theMatrix.AutoResizeColumns();
col = theMatrix.Columns.Item("desc1");
col.DataBind.SetBound(true, "", "salesUds");
uds.Value = "Test description";
// setting the user data source data
theMatrix.LoadFromDataSource();
oForm.Freeze(false);
oForm.Update();
I really need to get this working. ANyone got any ideas what I am doing wrong?Hi Laura,
You should use theMatrix.SetLineData() which is the avaiable statement for user matrixes.
Here is some code that loads a form with a matrix from an XML. This way you can edit form values in the XML, instead of hard coding.
Dim oXMLDoc1 As Xml.XmlDocument = New Xml.XmlDocument
oXMLDoc1.Load("C:BaseForm.xml")
App.LoadBatchActions(oXMLDoc1.InnerXml)
Dim oForm As SAPbouiCOM.Form = App.Forms.GetForm("ITA0002", 1)
Dim oMatrix As SAPbouiCOM.Matrix = oForm.Items.Item("5").Specific()
Dim Informes As SAPbouiCOM.UserDataSource = oForm.DataSources.UserDataSources.Item("Informes")
Dim ID As SAPbouiCOM.UserDataSource = oForm.DataSources.UserDataSources.Item("ID")
Dim i As Int16 = 1
oMatrix.AddRow(ListaInformes.Length)
For Each Informe As String In NameList
Informes.ValueEx = Informe
ID.ValueEx = i.ToString
oMatrix.SetLineData(i)
i = i + 1
Next
The xml is this one:
<?xml version="1.0" encoding="UTF-16"?>
<Application>
<forms>
<action type="add">
<form AutoManaged="1" BorderStyle="4" FormType="ITA0002" ObjectType="-1" SupportedModes="1" appformnumber="ITA0002" client_height="284" client_width="291" color="0" default_button="1" height="316" left="363" mode="1" pane="1" title="Informes" top="149" type="4" visible="1" width="297">
<datasources>
<userdatasources>
<action type="add">
<datasource size="254" type="9" uid="Informes"></datasource>
</action>
<action type="add">
<datasource size="10" type="9" uid="ID"></datasource>
</action>
</userdatasources>
</datasources>
<items>
<action type="add">
<item AffectsFormMode="1" backcolor="-1" description="" disp_desc="0" enabled="1" font_size="0" forecolor="0" from_pane="0" height="19" left="6" linkto="" right_just="1" supp_zeros="0" tab_order="10" text_style="0" to_pane="0" top="260" type="4" uid="1" visible="1" width="65">
<AutoManagedAttribute></AutoManagedAttribute>
<specific caption="OK"></specific>
</item>
<item AffectsFormMode="1" backcolor="-1" description="" disp_desc="0" enabled="1" font_size="0" forecolor="0" from_pane="0" height="19" left="77" linkto="" right_just="1" supp_zeros="0" tab_order="20" text_style="0" to_pane="0" top="260" type="4" uid="2" visible="1" width="65">
<AutoManagedAttribute></AutoManagedAttribute>
<specific caption="Cancelar"></specific>
</item>
<item AffectsFormMode="1" backcolor="-1" description="" disp_desc="0" enabled="1" font_size="0" forecolor="-1" from_pane="0" height="20" left="5" linkto="" right_just="0" supp_zeros="0" tab_order="0" text_style="0" to_pane="0" top="5" type="99" uid="3" visible="1" width="80">
<AutoManagedAttribute></AutoManagedAttribute>
<specific AffectsFormMode="1" caption="Informes" val_off="0" val_on="1">
<databind alias="Informes" databound="1" table=""></databind>
</specific>
</item>
<item AffectsFormMode="1" backcolor="-1" description="" disp_desc="0" enabled="1" font_size="0" forecolor="-1" from_pane="1" height="224" left="8" linkto="" right_just="0" supp_zeros="0" tab_order="60" text_style="0" to_pane="1" top="28" type="127" uid="5" visible="1" width="276">
<AutoManagedAttribute></AutoManagedAttribute>
<specific SelectionMode="2" layout="0" titleHeight="0">
<columns>
<action type="add">
<column AffectsFormMode="1" backcolor="-1" description="" disp_desc="0" editable="0" font_size="12" forecolor="-1" right_just="0" text_style="0" title="2" type="16" uid="2" val_off="N" val_on="Y" visible="1" width="20">
<databind alias="ID" databound="1" table=""></databind>
<ExtendedObject></ExtendedObject>
</column>
<column AffectsFormMode="1" backcolor="-1" description="" disp_desc="0" editable="0" font_size="12" forecolor="-1" right_just="0" text_style="0" title="Nombre" type="16" uid="1" val_off="" val_on="" visible="1" width="255">
<databind alias="Informes" databound="1" table=""></databind>
<ExtendedObject></ExtendedObject>
</column>
</action>
</columns>
</specific>
</item>
</action>
</items>
<items>
<action type="group">
<item uid="3"></item>
<item uid="4"></item>
</action>
</items>
<FormMenu></FormMenu>
<DataBrowser></DataBrowser>
</form>
</action>
</forms>
</Application>
Regards,
Ibai Peñ -
DI UI : fill matrix with a query from user table data
hello,
I create a user table.
I want to fill a matrix on a form with some aggregated data of this user table.
I do :
Public Sub SetMatrixRep()
Dim oRecordSet As SAPbobsCOM.Recordset
Dim oCentre As SAPbouiCOM.EditText
Dim oCompte As SAPbouiCOM.EditText
Dim oBudget As SAPbouiCOM.EditText
Dim oDepense As SAPbouiCOM.EditText
Dim oSolde As SAPbouiCOM.EditText
Dim i As Long
i = 0
Set oRecordSet = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
oRecordSet.DoQuery ("select * from [@CAP_OPRC_BUDGET]")
While oRecordSet.EOF = False
' filling the matrix
Set oCentre = oMatrixRep.Columns("clCentre").Cells.Item(i).Specific
oCentre.String = oRecordSet.Fields.Item(0).Value
'oMatrixRep.Columns("clCentre").Cells(1).Specific.String = oRecordSet.Fields.Item(0).Value
'SBO_Application.MessageBox (oRecordSet.Fields.Item(0).Value)
oMatrixRep.AddRow
oRecordSet.MoveNext
i = i + 1
Wend
End Sub
I've got an error : Row - Index invalid.
Could you help me please ?
Thanks.
Romeo.Hi
This is a routine that I call from my Item Event handler
Hope it can help you
Public Sub PopolaMatrice(oApplicazione As SAPbouiCOM.Application, pVal As SAPbouiCOM.IItemEvent)
Dim oForm As SAPbouiCOM.Form
Dim oMatrix As SAPbouiCOM.Matrix
Dim oDBDataSource As SAPbouiCOM.DBDataSource
Dim oConditions As New SAPbouiCOM.Conditions
Dim oCondition As SAPbouiCOM.Condition
Dim oDocNum As SAPbouiCOM.EditText
Dim lIndice As Long
Set oForm = oApplicazione.Forms.GetFormByTypeAndCount(pVal.FormType, pVal.FormTypeCount)
Set oDBDataSource = oForm.DataSources.DBDataSources.Item("MyUserTableName")
Set oMatrix = oForm.Items("MyMatrixName").Specific
oMatrix.Clear
'setting the condition object
'this is equal to the following SQL statement
'WHERE UserFieldName1 = "MyCriteria1" and UserFieldName2 = "MyCriteria2"
Set oCondition = oConditions.Add()
oCondition.BracketOpenNum = 2
oCondition.Alias = "UserFieldName1"
oCondition.Operation = co_EQUAL
oCondition.CondVal = "MyCriteria1"
oCondition.BracketCloseNum = 1
oCondition.Relationship = cr_AND
Set oCondition = oConditions.Add()
oCondition.BracketOpenNum = 1
oCondition.Alias = "UserFieldName2"
oCondition.Operation = co_EQUAL
oCondition.CondVal ="MyCriteria2"
oCondition.BracketCloseNum = 2
oDBDataSource.Query oConditions
'filling the matrix
For lIndice = 0 To oDBDataSource.Size - 1
oDBDataSource.Offset = lIndice
oMatrix.AddRow
Next lIndice
End Sub -
Hi,
i created an empty matrix on a form and i am trying to fill data in it with recordset ans userdatsource.
I tested my recrdset query and it is working but my matrix want show me data when the form is loaded.
this is my code :
public static void FillUserDataSource()
Globals.TestRecordSet = (SAPbobsCOM.Recordset) Globals.company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
Globals.TestRecordSet.DoQuery(("SELECT DocNum,ORDR.CardCode,City FROM ORDR,OCRD WHERE ORDR.CardCode=OCRD.CardCode"));
if (Globals.TestRecordSet.RecordCount != 0)
Globals.TestRecordSet.MoveFirst();
while (!Globals.TestRecordSet.EoF)
for (int i = 0; i < 3; i++)
Globals.TestForm.DataSources.UserDataSources.Item(i).ValueEx = (string)Globals.TestRecordSet.Fields.Item(i).Value;
Globals.ComMatrix.AddRow(1,0);
Globals.TestRecordSet.MoveNext();
Thanks for your help.hi,
i tried your code and it is the same it wont display.
i ll show you all my code .
using System;
using System.Collections.Generic;
using System.Text;
namespace FormsTest
public class FormOp
public FormOp(string filename, string formid)
DrawForm(filename, formid);
AddDatasourceToForm();
DataBindToForm();
FillUserDataSource();
public static void DrawForm(string filename, string formid)
XmlOperations.LoadFromXml(filename);
try
Globals.TestForm = Globals.sboApplication.Forms.Item(formid);
catch (Exception e)
Globals.sboApplication.MessageBox(e.Message, 1, "OK", "", "");
Globals.TestItem = Globals.TestForm.Items.Item("dteliv");
Globals.DatLivText = (SAPbouiCOM.EditText)Globals.TestItem.Specific;
Globals.TestItem = Globals.TestForm.Items.Item("pcom");
Globals.PoidCom = (SAPbouiCOM.EditText)Globals.TestItem.Specific;
Globals.TestItem = Globals.TestForm.Items.Item("pcomrest");
Globals.PoidComRestant = (SAPbouiCOM.EditText)Globals.TestItem.Specific;
Globals.TestItem = Globals.TestForm.Items.Item("pchar");
Globals.PoidChar = (SAPbouiCOM.EditText)Globals.TestItem.Specific;
Globals.TestItem = Globals.TestForm.Items.Item("pcharrest");
Globals.PoidCharRestant = (SAPbouiCOM.EditText)Globals.TestItem.Specific;
Globals.TestItem = Globals.TestForm.Items.Item("matcom");
Globals.ComMatrix = (SAPbouiCOM.Matrix)Globals.TestItem.Specific;
Globals.TestItem = Globals.TestForm.Items.Item("matcom1");
Globals.Com1Matrix = (SAPbouiCOM.Matrix)Globals.TestItem.Specific;
Globals.TestItem = Globals.TestForm.Items.Item("matstock");
Globals.StockMatrix = (SAPbouiCOM.Matrix)Globals.TestItem.Specific;
Globals.TestItem = Globals.TestForm.Items.Item("matstock1");
Globals.Stock1Matrix = (SAPbouiCOM.Matrix)Globals.TestItem.Specific;
Globals.TestItem = Globals.TestForm.Items.Item("matveh");
Globals.VehiculMatrix = (SAPbouiCOM.Matrix)Globals.TestItem.Specific;
Globals.TestItem = Globals.TestForm.Items.Item("matveh1");
Globals.Vehicul1Matrix = (SAPbouiCOM.Matrix)Globals.TestItem.Specific;
Globals.TestItem = Globals.TestForm.Items.Item("creeliv");
Globals.CreerLiv = (SAPbouiCOM.Button)Globals.TestItem.Specific;
Globals.TestItem = Globals.TestForm.Items.Item("interr");
Globals.Interr = (SAPbouiCOM.Button)Globals.TestItem.Specific;
Globals.TestItem = Globals.TestForm.Items.Item("NComCol");
Globals.NComCol = (SAPbouiCOM.Column)Globals.TestItem.Specific;
Globals.TestItem = Globals.TestForm.Items.Item("NomClCol");
Globals.NomClCol = (SAPbouiCOM.Column)Globals.TestItem.Specific;
Globals.TestItem = Globals.TestForm.Items.Item("PoComCol");
Globals.PoComCol = (SAPbouiCOM.Column)Globals.TestItem.Specific;
Globals.TestItem = Globals.TestForm.Items.Item("VilLivCol");
Globals.VilLivCol = (SAPbouiCOM.Column)Globals.TestItem.Specific;
Globals.TestItem = Globals.TestForm.Items.Item("VolComCol");
Globals.VolComCol = (SAPbouiCOM.Column)Globals.TestItem.Specific;
public static void AddDatasourceToForm()
SAPbouiCOM.UserDataSource oUserDataSource;
oUserDataSource = Globals.TestForm.DataSources.UserDataSources.Add("ComDataSource", SAPbouiCOM.BoDataType.dt_SHORT_TEXT, 20);
public static void DataBindToForm()
Globals.NomClCol.DataBind.SetBound(true, "", "ComDataSource");
Globals.NomClCol.DataBind.SetBound(true, "", "ComDataSource");
Globals.VilLivCol.DataBind.SetBound(true, "", "ComDataSource");
Globals.PoComCol.DataBind.SetBound(true, "", "ComDataSource");
Globals.VolComCol.DataBind.SetBound(true, "", "ComDataSource");
public static void FillUserDataSource()
Globals.TestRecordSet = (SAPbobsCOM.Recordset)Globals.company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
Globals.TestRecordSet.DoQuery(("SELECT DocNum,ORDR.CardCode,City FROM ORDR,OCRD WHERE ORDR.CardCode=OCRD.CardCode"));
if (Globals.TestRecordSet.RecordCount != 0)
Globals.TestRecordSet.MoveFirst();
while (!Globals.TestRecordSet.EoF)
Globals.ComMatrix.AddRow(1, 0);
for (int i = 0; i < 3; i++)
Globals.TestForm.DataSources.UserDataSources.Item(i).ValueEx = (string)Globals.TestRecordSet.Fields.Item(i).Value;
Globals.ComMatrix.SetLineData(Globals.ComMatrix.RowCount);
Globals.TestRecordSet.MoveNext(); -
When loading a table from the database in a Matrix, I like this:
- I created the method of example "CreateFormWithMatrix."
- OItem oForm.Items.Add = ("Matrix1" SAPbouiCOM.BoFormItemTypes.it_MATRIX);
=-oColumns oMatrix.Columns;
oColumns.Add-oColumn = ("Code" SAPbouiCOM.BoFormItemTypes.it_EDIT);
oForm.DataSources.UserDataSources.Add-oUserDataSource = ("IntPhone" SAPbouiCOM.BoDataType.dt_SHORT_TEXT, 20);
oForm.DataSources.DBDataSources.Add-oDBDataSource = ("@ TB_TESTE");
- OColumn oColumns.Item = ("Code");
oColumn.DataBind.SetBound (true, "@ TB_TESTE", "Code");
-oMatrix.Clear ();
-oMatrix.AutoResizeColumns ();
-oDBDataSource.Query ();
-oUserDataSource.Value = "prefix";
-oMatrix.LoadFromDataSource ();
So fill the matrix with all data from my table.
How do I show in my matrix to only the data that filter through a select?
Example: Show the data in the matrix where the name is "Jesus."Hello
You can fill matrix with a query, using datatable
You may try this sample
Dim oForm As SAPbouiCOM.Form = sbo_application.Forms.Add("MATRIXTEST")
oForm.Visible = True
oForm.Width = 300
oForm.Height = 400
oForm.DataSources.DataTables.Add("oMatrixDT")
oForm.DataSources.DataTables.Item("oMatrixDT").Clear()
Dim sSQL As String = "SELECT * FROM OQUT WHERE Name= 'Jesus' "
oForm.DataSources.DataTables.Item("oMatrixDT").ExecuteQuery(sSQL)
Dim oItem As SAPbouiCOM.Item = oForm.Items.Add("oMTX", SAPbouiCOM.BoFormItemTypes.it_MATRIX)
Dim oMatrix As SAPbouiCOM.Matrix = oItem.Specific
Dim oColumn As SAPbouiCOM.Column = oMatrix.Columns.Add("#", SAPbouiCOM.BoFormItemTypes.it_EDIT)
oColumn.TitleObject.Caption = "#"
oColumn = oMatrix.Columns.Add("1", SAPbouiCOM.BoFormItemTypes.it_EDIT)
oColumn.DataBind.Bind("oMatrixDT", "Col1")
oColumn.TitleObject.Caption = "Customer Code"
oColumn = oMatrix.Columns.Add("2", SAPbouiCOM.BoFormItemTypes.it_EDIT)
oColumn.DataBind.Bind("oMatrixDT", "DocEntry")
oColumn.TitleObject.Caption = "Quote Key"
oColumn = oMatrix.Columns.Add("3", SAPbouiCOM.BoFormItemTypes.it_EDIT)
oColumn.DataBind.Bind("oMatrixDT", "NumAtCard")
oColumn.TitleObject.Caption = "Cust Ref Number"
oColumn = oMatrix.Columns.Add("4", SAPbouiCOM.BoFormItemTypes.it_EDIT)
oColumn.DataBind.Bind("oMatrixDT", "DocDate")
oColumn.TitleObject.Caption = "Document Date"
oColumn.DisplayDesc = False
oMatrix.LoadFromDataSource()
Regards -
Hi All,
I need to create a 5/5 matrix in SSRS report. The data will be :
Col_Side Col_Header Col_data
1 1 1
1 1 1
1 2 1
1 5 1
1 5 1
1 5 1
2 3 1
2 5 1
3 1 2
3 1 2
3 1 2
4 2 1
4 4 1
5 1 1
5 1 1
5 5 1
So, the matrix column will be Col_Header and matrix row will be Col_Side and count(Col_data) will be on the data.
Finally, it will create a 5 by 5 matrix with Count(Col_data) as its data for each combinations. If there is no combination (for ex: in the above data we do not have no combination of (1,3) , (1,4) , (2,1) etc..) then the matrix will be filling that corresponding
cell with zero.
Here I need to fill the cells with some colors based on some criteria.
I need to fill (5,3), (5,4), (5,5) combination with "Red" color. Like this , I need to give different colors in each of the cells. Here, (5,5) combination will be having 1 in its cell. (5,4) and (5,3) will be having zero in its corresponding
cells. I 'm trying to fill all the 3 cells with "Red" color. But, I am able to fill only (5,5) with "Red" color. Since the other 2 cells (5,3) and (5,4), has zero in their cells, it will not fill the cells with "Red" color.
How can I fill those two cells (5,3) and (5,4) with red color?
I know this is very vague. I have no option to give the picture here..
Please suggestHi Julie,
According to your description, there is a 5/5 matrix with three fields: Col_Side, Col_Header, Col_data. You drag Col_Side field to Rows, Col_Header to Columns and Col_data to Data, then filling blank cells with zero using expression. Now you want to fill
(5,3), (5,4), (5,5) cells with red color using expression, but it has no effect on cells (5,3) and (5,4).
According to my test, the expression has on effect on cells (5,3) and (5,4) since there is no corresponding data and the cells are blank. As a workaround, we can insert data for cells (5,3) and (5,4) in dataset, then use expression by following steps:
In the dataset, insert two sets of data (5,3,0), (5,4,0).
Right-click the cell of data, click Text Box Properties.
Click Fill in left pane, click (fx) button, then type the expression like below, then click OK.
=iif(Fields!Col_Side.Value=5 and Fields!Col_Header.Value >=3 ,"red","white" )
The following screenshot is for your reference:
If you have any more questions, please feel free to ask.
Thanks,
Wendy Fu -
How to fill the first column '#' of matrix with row id in user form?
Hi All,
I am having a user defined form in which, I m having a matrix and m populating the matrix with the output of an sql query.
something like this:
SQL_Str= "select col1,col2,......from.... "
OPopDBTable.ExecuteQuery(SQL_Str)
oMatrix.AddRow()
oMatrix.Columns.Item("Col3").DataBind.Bind("PopTable", "col1")
oMatrix.Columns.Item("Col2").DataBind.Bind("PopTable", "col2")
oMatrix.LoadFromDataSource()
Now, in this, how can I assign row number to first column ('#' column ) ??
regards,
BinitaAh...the ROW_NUMBER() was posted by Petr - also thank you (again)
With my example-query from the other thread:
SELECT
CAST(
ROW_NUMBER() OVER (ORDER BY T1.U_LogNo ASC) AS INT
) AS RowCnt,
T1.Code,
T1.U_ParcelNo,
T1.U_LogNo
FROM
[@XXX_EXAMPLE] T1
WHERE
T1.U_ParcelNo='132006'
ORDER BY
T1.U_LogNo ASC
...this works for me (it's quickly copied from several subs/func. - I hope it's not too much disordered):
DtLogs.ExecuteQuery(query)
oMtxLogs.Columns.Item("0").DataBind.Bind("DT_LOGS", "RowCnt")
oMtxLogs.Columns.Item("1")........
oMtxLogs.LoadFromDataSource() -
LightSwitch Fill Form with a Query
Hi,
I added a button in an add and edit screen to edit information related to the paticular id I am editing but need to launch another edit screen so I can edit the information stored in another non relational table with the id in the previous screen. Since
I do not have an entity information of that table I needed to pass the id and the edit form be fill in with a query so I can edit that table after.
Anyone has an idea would appreciate it.
Thanks,Yeah, the way I usually go about doing that sort of thing is by overloading the main constructor of the Form which does the editing..
So for example:
public Form1(){
Initialise();
You'd also make another like this:
public Form1(int id){
Initialise();
LoadRecord(id);
To open up the form you'd write this in the event handler of the original form:
Form frm = new Form(123);
frm.Show();/frm.Visible=true; (whatever it is)
Hope this helps,
Antony
:D -
Hi,
I like to fill system Matrix with data; please find the code below.
Thank you very much for your good work and support.
Thank you,
Rune
CODE
#region SalesOrderItemLine_GetDataFromDataSource
public void SalesOrderItemLine_GetDataFromDataSource( SAPbouiCOM.Form oForm, bool Matrix77_AddRefresh )
try
if ( Matrix77_AddRefresh )
oForm.DataSources.DataTables.Add("SYS_77");
oForm.DataSources.DataTables.Item("SYS_77").ExecuteQuery("SELECT [Code],[Name],[U_Weight],[U_PoNo],[U_CoopName],[U_Consignee],[U_PalGroup],[U_Container],[U_ItemCode],[U_CheckBoxSelect] FROM [dbo].[@MyTable] WHERE [U_MatrixAorB] = 'A' AND [U_WRKsalesOrderYN] = 'N'");
( ( SAPbouiCOM.Matrix ) ( oForm.Items.Item("77").Specific ) ).Columns.Item("1").DataBind.Bind("SYS_77", "U_ItemCode");
( ( SAPbouiCOM.Matrix ) ( oForm.Items.Item("77").Specific ) ).Clear();
( ( SAPbouiCOM.Matrix ) ( oForm.Items.Item("77").Specific ) ).LoadFromDataSource();
( ( SAPbouiCOM.Matrix ) ( oForm.Items.Item("77").Specific ) ).AutoResizeColumns();
catch ( Exception Error )
oApplication.MessageBox("Add-On Error-3232: = " + Error.Message, 1, "Ok", "", ""); // My Error Code
#endregionHi David!
This is a Product Development Collaboration suggestion!
I like to load data into system matixes...that could be really nice!
(No my problem is still out there...
Thank you,
Rune -
NEED HELP IN MATRIX WITH GROUP REPORT
Dear All,
I need small help in MATRIX WITH GROUP REPORT In Report Builder Test Report
In my report, having periods as rows and location as columns as shown below,
1) LOC-A
JAN-10 FEB-10
ITEM-GROUP -1 1 2
ITEM-GROUP-2 3 4
ITEM-GROUP 3 5 6
2) LOC- B
MAR-10 APR-10
ITEM-GROUP -1 7 8
ITEM-GROUP-2 9 10
ITEM-GROUP-3 11 12
But comming to my requirement, the periods should be in fix in matrix as shown below
1) JAN-10 FEB-10 MAR-10 APR-10
LOC-A
ITEM-GROUP -1 1 2
ITEM-GROUP-2 3 4
ITEM-GROUP 3 5 6
LOC- B
ITEM-GROUP -1 0 0 7 8
ITEM-GROUP-2 0 0 9 10
ITEM-GROUP-3 0 0 11 12
I am unable to get this kind of output format
Please kindly waiting for reply from our team....
Regards
krishna.PFor the periods, create a seperate dummy query and then use it as column group in the multi query matrix.
-
Hi:
I need to combine two complex queries to form a report. I was able to create Matrix with Groups style for the first query, but I could not create the second one with the same style.
Is it possible for creating a second query with a Matrix with Groups Style by using Additional Default Layout in the Layout Model?
Thanks in advance for any help.
Tracy
nullhello,
the report wizard only supports the creation of one layout. however by using the report block wizard (additional default layout) you can add another layout to your report. but be aware that this wizard assumes you already have the datamodel for it. if not you have to invoke the datawizard first and then invoke the report-block wizard.
regards,
the oracle reports team -
SharePoint 2013 List View with query string filter stops working after editing view from browser
I have created one list definition in which I have added one list view which will filter data from query string paramater
So when I am creating list from my list definition, view with query string filter is working fine.
But when I am modifying view from UI(I am not changing any thing , just opening "Modify View" page and then click on "Save" button), view gets stop working means it's not filtering data based on query string
Any suggestion what I am missing?
Below is my list view schema
<View BaseViewID="11" Type="HTML" TabularView="FALSE" WebPartZoneID="Main" DisplayName="$Resources:OIPLBScoreCard,viewFilterTasksByTarget;" MobileView="True" MobileDefaultView="False" Url="FilteredTasks.aspx" SetupPath="pages\viewpage.aspx" DefaultView="FALSE" ImageUrl="/_layouts/15/images/issuelst.png?rev=23">
<Toolbar Type="Standard" />
<ParameterBindings>
<ParameterBinding Name="NoAnnouncements" Location="Resource(wss,noXinviewofY_LIST)" />
<ParameterBinding Name="NoAnnouncementsHowTo" Location="Resource(wss,noXinviewofY_DEFAULT)" />
<ParameterBinding Name="TargetId" Location="QueryString(TargetId)" />
</ParameterBindings>
<JSLink>hierarchytaskslist.js</JSLink>
<XslLink Default="TRUE">main.xsl</XslLink>
<JSLink>clienttemplates.js</JSLink>
<RowLimit Paged="TRUE">100</RowLimit>
<ViewFields>
<FieldRef Name="Body"></FieldRef>
<FieldRef Name="Title"></FieldRef>
<FieldRef Name="StartDate"></FieldRef>
<FieldRef Name="DueDate"></FieldRef>
</ViewFields>
<ViewData>
<FieldRef Name="PercentComplete" Type="StrikeThroughPercentComplete"></FieldRef>
<FieldRef Name="DueDate" Type="TimelineDueDate"></FieldRef>
</ViewData>
<Query>
<Where>
<Eq>
<FieldRef Name="oipscTargetLookup" LookupId="TRUE"/>
<Value Type="Lookup">{TargetId}</Value>
</Eq>
</Where>
</Query>
</View>
I have one lookup field from "Target List" in my source list and I want to filter data based on that lookup field.Hi JayJT,
The Miscellaneous is located in the contact list that you used for the connection.
So , you need to edit the page, then edit the contact list that you used, in the web part properties of the contact list, you will find Miscellaneous, then expand it and select ‘Server Render’ .
I hope this helps.
Thanks,
Wendy
Wendy Li
TechNet Community Support -
How do I create a shortcut to fill cells with the same background colour
I have recently starting using Numbers, being an Excel user for years.
I often fill cells with a yellow background to highlight them.
In Excel you can do this from a simple colour menu in the toolbar at the top.
I have found no quick and easy way to do this in Numbers.
Any advice would be appreciated.
thank youAs far as I can tell there's no direct equivalent of the little paintbucket button in Excel that remembers the last colour you filled with.
One quick and relatively easy way to achieve it would be with an AppleScript:
tell application "Numbers" to tell front document to tell active sheet
try
set active_table to (first table whose class of selection range is range)
on error
display alert "No selection" buttons {"OK"} default button 1
return
end try
tell active_table
set background color of selection range to {62466, 65535, 28003}
end tell
end tell
This could be run from Numbers' script menu (screen grab below) or saved as an Automator Service and run from a popup or keyboard shortcut (eg ctrl-y).
Post back if you'd like to follow up either of those ideas. -
Uncheck "Fill screen with one page at a time"
Is it possible to set a javascript to turn off the preference "Fill screen with one page at a time" when entering in Full Screen mode? So that way, it will override Acrobat or Reader application preferences when the PDF is open on users computers.
Everything that's supported is documented here: http://livedocs.adobe.com/acrobat_sdk/11/Acrobat11_HTMLHelp/JS_API_AcroJS.89.768.html
Unfortunately, what you want isn't supported.
Maybe you are looking for
-
Brand new ipad 3 can't slide to unlock, any ideas?
I've got a new ipad 3 64gb, less than 24 hrs old. it has sat idle for a couple of hours. awake button works, but not the slide to unlock. can't power it down either for the same reason. any ideas? Hard restart worked.
-
Premiere Elements 9 crashes when trying to create new project?
I dont seem to be able to get this application to work..... it was fine a few months ago, but when I went to create a new project it continually crashes out when you try and open an existing or new project file. can anyone suggest a possible rememdy
-
Error, missing customer master when creating sales order, master data exist
Hi, i am trying to create a sales order but the systems gives me an error that the customer does not exist, whereas the customer record does exist and was created centrally. please help me resolve this issue. Thanks Admire
-
HT204382 I can not see the video.
Hello, I can not see the video which is crate by windows program
-
Release 11.5.10 or 12 on one node (server)?
Has anybody got the entire e-business suite release 12 or 11.5.10 running on a single HPUX box? I'd like to hear your experiences - how many users, how is performance? We are thinking of collapsing a node. Thanks.