Adjacency List / Adjacency Matrix

Hello All,
I am very new to Java programming and looking for some examples:
1) How I can create an Adjacency List structure consisting of random numbers in a form of Skewed, Uniform, or Two-Tier Distributions.
2) Create a matrix (two-dimentional array, and this part is easy). The difficult part is how can I create two dimentional array with random number distribution for 1's and 0's (i.e. adjacency matrix) in a form of Skewed, Uniform, or Two-Tier Distributions.
Thank you!

If I'm getting this right, I think the 2 problems above are down to one question:
1) How to create a random number generation method for {Skewed, Uniform, Two-Tier, ...} Distribution?
One solution I can immediately think of is as follows:
import static java.lang.Math.*;
// Cumulative Distribution Function
public interface CDF {
    // probability by a given x
    double p(double x);
    // x from a given probability p
    double x(double p);
// Example - Normal Distribution
public class NormalDistribution implements CDF {
    private double mean, sd;
    public NormalDistribution(double mean, double sd) {
        this.mean = mean;
        this.sd = sd;
    private double phi(double z) {
        double t = 1.0 / (1.0 + 0.2316419 * x);
        return 1.0 - (exp(-z*z / 2.0) / sqrt(2.0 * PI)) * (0.31938153 * t - 0.356563782 * pow(t, 2.0) + 1.781477937 * pow(t, 3.0) - 1.821255978 * pow(t, 4.0) + 1.330274429 * pow(t, 5.0));
    private double inversePhi(double p) {
        double a = p > 0.5 ? 1.0 - p : p;
        double t = sqrt(log(1.0 / (p*p)));
        double t2 = t*t, t3 = t2*t;
        return (p > 0.5 ? 1.0 : -1.0) * (t - (2.515517 + 0.802853 * t + 0.010328 * t2) / (1 + 1.432788 * t + 0.189269 * t2 + 0.001308 * t3));
    public double p(double x) {
        return phi((x - mean) / sd);
    public double x(double p) {
        return inversePhi(p) * sd + mean;
// RandomNumberGenerator
public class RNG<T extends CDF> {
    private T dist;
    public RNG(T dist) {
        this.dist = dist;
    public double rand() {
        return x(rand());
}Thus with the following line:
RNG NR = new RNG<NormalDistribution>(new NormalDistribution(10.0, 5.0));You'll have NR as a random number generator that will give numbers that are normally distributed.
Of course if you just need discrete distributions instead of continuous ones, you can make similar definitions using long or int instead of double
Hope this helps~
Alex Lam S.L.

Similar Messages

  • Adjacency Matrix in MDS using a recursive derived hierarchy

    Hello everyone!
    I'm looking for some great examples of how to do an adjacency matrix in Master Data Services while using the recursive derived hierarchy.  Is this even possible or do I need to use an explicit hierarchy?
    I'd really like to avoid using the explicit hierarchy because I'd like to be able to define the matrix and enforce adjacency relationship with that matrix.
    I hope I'm making sense here...

    Gersh,
    It works now. I have implemented the below code (ENTITY needed to contain the variable as well). The relationship profitcenter and entity is very important as it derives the relevant profitcenters from the profit center hierarchy (e.g. all profitcenters under the legalentity node).
    //ALLOCATION PROCEDURE CONVERSION RATE
    //=====================================
    *FOR %ENT% = %ENTITY_SET%
    *RUNALLOCATION
    *FACTOR=1
    *DIM SEBACCOUNT WHAT=CONV_RATE; WHERE=<<<; USING=<<< ; TOTAL=<<<
    *DIM PROFCENT WHAT=DUMPC; WHERE=BAS(BPC_%ENT%);USING=<<<; TOTAL=<<<
    *DIM CATEGORY WHAT=FCSTCUR; WHERE=<<<; USING=<<< ; TOTAL=<<<
    *DIM ENTITY WHAT=%ENT%; WHERE=<<<; USING=<<<; TOTAL=<<<
    *ENDALLOCATION
    *NEXT
    Thanks
    Nico

  • Compile error in adjacency matrix

    Hello, I'm getting a strange compile error in my fileStream constructor
    also I'm having trouble accessing nodes.
    Any advice is much much appreciated and will be rewarded as such
    cheers
    mport java.io.*;
    import java.util.*;
    class AdjMatrix
         private int [][] matrix;
         private int num_vertices;
         private final int inf = Integer.MAX_VALUE;
         public AdjMatrix(int num_vertices)
              this.num_vertices = num_vertices;
              matrix = new int[num_vertices][num_vertices];
              // let's assume that nodes are adjacent to themselves
              for (int vertex = 0; vertex < num_vertices; vertex++)
                   for (int other_vertex = 0; other_vertex < num_vertices; other_vertex++)
                        if (other_vertex == vertex)
                             matrix[vertex][other_vertex] = 0;
                        else
                             matrix[vertex][other_vertex] = inf;
         public void addEdge(int vertex_from, int vertex_to, int cost)
              matrix[vertex_from][vertex_to] = cost;
         public void addEdge(int vertex_from, int vertex_to)
              addEdge(vertex_from, vertex_to, 0);
         public void addBidirectedEdge(int vertex_one, int vertex_two, int cost)
              addEdge(vertex_one, vertex_two, cost);
              addEdge(vertex_two, vertex_one, cost);
         public void addBidirectedEdge(int vertex_one, int vertex_two)
              addEdge(vertex_one, vertex_two, 0);
              addEdge(vertex_two, vertex_one, 0);
         public void removeEdge(int vertex_from, int vertex_to)
              matrix[vertex_from][vertex_to] = inf;
         public void removeBidirectedEdge(int vertex_one, int vertex_two)
              matrix[vertex_one][vertex_two] = inf;
              matrix[vertex_two][vertex_one] = inf;
         public int getEdge(int vertex_from, int vertex_to)
              return matrix[vertex_from][vertex_to];
    class FileStream extends AdjMatrix {
         double answer;
         String line;
         AdjMatrix theMatrix;
         int total;
         public FileStream(String fileName) {
              fileName = "Test.txt";
              try {
                   FileReader fileRead = new FileReader(fileName);
                   BufferedReader br = new BufferedReader(fileRead);
                   while((line = br.readLine()) !=null) {
                        StringTokenizer st = new StringTokenizer(line, ",");
                        total++;
                        for(int i=0; i<st.countTokens(); i++){
                             for(int j=0; j<st.countTokens(); j++) {
                                  int weight = Integer.parseInt(st.nextToken());
                                  theMatrix.addEdge(i,j,weight);
                   br.close();
              catch(IOException exc) {
                   System.out.println("File not found!");
         //System.out.println("The total in [Test.txt] is: " +total);     
    }

    class FileStream extends AdjMatrix {
         double answer;
         String line;
         AdjMatrix theMatrix;
         int total;
         public FileStream(String fileName) {
              Since you don't specify which constructor of AdjMatrix to use in the contruction of FileStream the compiler is trying to use the default constructor of AdjMatrix BUT you don't have one!
    Possible solutions -
    1) Define a default constructor in AdjMatrix.
    2) Use the public AdjMatrix(int num_vertices) constructor by using
         public FileStream(String fileName) {
                 super(10); // or what ever size you think is appropriate3) Change AdjMatrix to use so as to use dynamic arrays (ArrayList?) instead of having a fixed dimension.
    4) MakeFile stream a factory that does not extend AdjMatrix but has a method that returns an AdjMatrix based on a filename argument.
    e.g.
    class  FileStreamFactory
         public AdjMatrix createFromFile(String filename)
                 // Parse the file to get the size
                AdjMatrix theMatrix = new AdMatrix(the size you parsed);
                // Fill in anything else you need to
                return  theMatrix ;
    }You would use this by creating a factory and then using it to create your AdjMatrix.
    It should be obvious that I prefer approach 4.
    Have fun!

  • Choose from list in Matrix

    Hey All,
    Has anyone been able to get the choose from list in a matrix text field working in SBO 2005 patch level 6? We have tried the tech demo and it works for new rows but not for existing rows. Also we have written our own code to set the matrix text box on the choose from list event and we get a general failure exception even though the value still gets set properly.
    If anyone has this working please post so we can all know how to do this properly.

    Hi there,
    This "Choose from list" thing is new for me, there's a Choose from List example in the new techDemo but i don't understand the code.. too complicated for me.. Is there any simple code/sample for this?
    Well i manage to trigger the choose from list .. but don't know how to put the selected value to the cell..
    Bruce..

  • Choose From list in Matrix UDF

    i create a UDF in Sales Order Row, I want to assign choose From list in the Matrix for the UDF once user click on tab button.
    How can i assign the Choose from list for the UDF column?

    Hi,
    Try this code for adding CFL.             
                   SAPbouiCOM.ChooseFromListCollection oCFLs = null;
                    SAPbouiCOM.Conditions oCons = null;
                    SAPbouiCOM.Condition oCon = null;
                    oCFLs = oForm.ChooseFromLists;
                    SAPbouiCOM.ChooseFromList oCFL = null;
                    SAPbouiCOM.ChooseFromListCreationParams oCFLCreationParams = null;
                    oCFLCreationParams = ( ( SAPbouiCOM.ChooseFromListCreationParams )( SBO_Application.CreateObject( SAPbouiCOM.BoCreatableObjectType.cot_ChooseFromListCreationParams ) ) );
                    oCFLCreationParams.MultiSelection = false;
                    oCFLCreationParams.ObjectType = "object id ";
                    oCFLCreationParams.UniqueID = "CFL1";
                    oCFL = oCFLs.Add( oCFLCreationParams );
                   oColumn.ChooseFromListUID = "CFL1";
                  //where oColumn is the instance of that column.
    Hope u will get help....
    Thanks and Regards,
    Lalit

  • Error in Choose from list  on Matrix

    Hi all,
       I am using CFL in matrix for my user define form, When i choose a value from CFL , i am getting the following error
    <b>" Item -Can't set value on item because the item can't get focus [66000-153]"</b>
    <u>the code i used is given below</u>
    <u>this is in Item Event</u>
                                        Try
                If FormUID = ("FRMIGRP") Then
                    If pVal.Before_Action = False Then
                        If (pVal.EventType = SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST) Then
                            ' If pVal.EventType = SAPbouiCOM.BoEventTypes.et_GOT_FOCUS Then
                            Dim oCFLEvento As SAPbouiCOM.IChooseFromListEvent
                            oCFLEvento = pVal
                            Dim sCFL_ID As String
                            sCFL_ID = oCFLEvento.ChooseFromListUID
                            Dim oForm As SAPbouiCOM.Form
                            oForm = SBO_Application.Forms.Item(FormUID)
                            Dim oCFL As SAPbouiCOM.ChooseFromList
                            oCFL = oForm.ChooseFromLists.Item(sCFL_ID)
                            If oCFLEvento.BeforeAction = False Then
                                Dim oDataTable As SAPbouiCOM.DataTable
                                oDataTable = oCFLEvento.SelectedObjects
                                Dim val As String
                                Dim val1 As String
                                Dim val2 As String
                                Dim val3 As String
                                Try
                                    val = oDataTable.GetValue(0, 0)
                                    val1 = oDataTable.GetValue(1, 0)
                                Catch ex As Exception
                                    MessageBox.Show(ex.Message)
                                End Try
                                Try
                                    If (pVal.ItemUID = "txtcode") Then
                                        Dim oDS As SAPbouiCOM.DBDataSource
                                        oDS = oForm.DataSources.DBDataSources.Item("@PSSIT_GRPHDR") 'add your dbdatasource here
                                        oDS.SetValue("U_grpcode", oDS.Offset, val)  ' val1 is the value you are setting
                                        oDS.SetValue("U_grpname", oDS.Offset, val1)
                                    End If
                                Catch ex As Exception
                                    MessageBox.Show(ex.Message)
                                End Try                      
                                Try
                                    val2 = oDataTable.GetValue(0, 0)
                                    val3 = oDataTable.GetValue(1, 0)
                                    If (pVal.ItemUID = "matr") And (pVal.ColUID = "supp") Then
                                       Dim oEdit As SAPbouiCOM.EditText
                                        oMatrix.FlushToDataSource()
                                        oForm.DataSources.UserDataSources.Item("EditDS2").ValueEx = val2.ToString
                                        oEdit = subcol.Cells.Item(pVal.Row).Specific
                                        oEdit.Value = val2.ToString
                                        oEdit = subname.Cells.Item(pVal.Row).Specific
                                        oEdit.Value = val3.ToString
                                        ("EditDS2").ValueEx = Nothing
                                    End If
                                Catch ex As Exception
                                    MessageBox.Show(ex.Message)
                                End Try
                            End If
    And i used data source also to set the value using below code, but for that also value is not set in to the field
    Dim oEdit As SAPbouiCOM.EditText
                                        Dim oDS As SAPbouiCOM.DBDataSource
                                        oDS = oForm.DataSources.DBDataSources.Item("@PSSIT_GRPDTL") 'add your dbdatasource here
                                        oDS.SetValue("U_supcode", oDS.Offset, val2)  ' val1 is the value you are setting
                                        oDS.SetValue("U_supname", oDS.Offset, val3)
    SOmebody can help me to solve this issue
    Regards
    Suresh R

    Suresh,
    Try this one,
    Here i have used for check the dulpicate entry also, that is if we choose one item in the first row in second row or third we cant able to choose the same. If u no need just neglect it.
    Case SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST And pVal.BeforeAction = False
                        Dim oCFLE As SAPbouiCOM.IChooseFromListEvent
                        oCFLE = pVal
                        Dim CFLID As String
                        CFLID = oCFLE.ChooseFromListUID
                        PI_Frm = app.Forms.Item(FormUID)
                        Dim oCFL As SAPbouiCOM.ChooseFromList
                        oCFL = PI_Frm.ChooseFromLists.Item(CFLID)
    oCFL.UniqueID = "CFL2" Then
                            Dim oDT As SAPbouiCOM.DataTable
                            oDT = oCFLE.SelectedObjects
                            Try
                                Dim oMat As SAPbouiCOM.Matrix
                                Dim t, t1 As String
                                Dim Rec, Rec1, Rec2 As SAPbobsCOM.Recordset
                                oMat = PI_Frm.Items.Item("m_det").Specific
                                t = oDT.GetValue(0, 0)
                                t1 = oDT.GetValue(1, 0)
                                If Trim(HEAD_oDBds.GetValue("U_pid", 0)).Equals("") = False Then
                                    oMat.Columns.Item("rate").Editable = False
                                Else
                                    oMat.Columns.Item("rate").Editable = True
                                End If
                                Dim Bool As Boolean = False
                                For i As Integer = 1 To oMat.VisualRowCount
                                    oMat.GetLineData(i)
                                    If Trim(DETAIL_oDBds.GetValue("U_itno", (i - 1))).Equals(Trim(oDT.GetValue(0, 0))) = True Then
                                        Bool = False
                                        Exit For
                                    Else
                                        Bool = True
                                    End If
                                Next
                                If Bool = True Then
                                    If pVal.Row = oMat.VisualRowCount Then
                                        oMat.AddRow()
                                        oMat.FlushToDataSource()
                                        Me.SetEmptyRow(DETAIL_oDBds.Size)
                                    End If
                                    Rec = com.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
                                    Rec1 = com.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
                                    Rec2 = com.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
                                    Rec.DoQuery("select BuyUnitMsr from OITM where ItemCode ='" & Trim(oDT.GetValue(0, 0)) & "'")
                                    DETAIL_oDBds.Offset = (pVal.Row - 1)
                                    DETAIL_oDBds.SetValue("LineId", DETAIL_oDBds.Offset, pVal.Row)
                                    DETAIL_oDBds.SetValue("U_itno", DETAIL_oDBds.Offset, oDT.GetValue(0, 0))
                                    DETAIL_oDBds.SetValue("U_itdesc", DETAIL_oDBds.Offset, oDT.GetValue(1, 0))
                                    DETAIL_oDBds.SetValue("U_unit", DETAIL_oDBds.Offset, Rec.Fields.Item(0).Value)
                                    DETAIL_oDBds.SetValue("U_poqty", DETAIL_oDBds.Offset, "0")
                                    DETAIL_oDBds.SetValue("U_qnos", DETAIL_oDBds.Offset, "0")
                                    DETAIL_oDBds.SetValue("U_pur", DETAIL_oDBds.Offset, "")
                                    Rec1.DoQuery("select U_basicrate from [@RATE_MASTER_DETAIL] where U_itemid='" & oDT.GetValue(0, 0) & "'")
                                    DETAIL_oDBds.SetValue("U_rate", DETAIL_oDBds.Offset, Rec1.Fields.Item(0).Value)
                                    Rec2.DoQuery("select a.OnHand ,b.ItemCode,b.DfltWH,a.WhsCode from OITW a,OITM b where a.ItemCode=b.ItemCode and b.DfltWH=a.WhsCode and b.DfltWH='01' and b.ItemCode='" & oDT.GetValue(0, 0) & "'")
                                    DETAIL_oDBds.SetValue("U_stx", DETAIL_oDBds.Offset, Rec2.Fields.Item(0).Value)
                                    oMat.SetLineData(pVal.Row)
                                End If
    If it helps give me reward points.
    Regards,
    Anitha

  • Graph connectivity problem-adjacency list-connected graph-Theta complexity

    I am stuck up on this problem:
    I want to find an algorithm of Theta(n+m) complexity, which will examine
    if a non-directed graph is connected (synectic).
    We assume that the representation of the graph has been made with an
    adjacency list with n vertices and m edges.
    Thanks in advance.

    A BFS or DFS from any node in your graph should be T(n+m) in case of an adjacency list (instead of a adjacency matrix). When the search is finished, compare the number of visited nodes to the total number of nodes in the graph. If they're not equal, the graph is not connected.

  • Creating list from a matrix using pig

    I am new to Pig. Could somebody point me how this can be done ?
    I have a text file containing adjacency matrix:
    * x1 x2 x3 x4 x5
    x1 0 1 0 1 1
    x2 0 0 0 1 0
    x3 0 0 0 0 1
    x4 0 0 0 0 0
    x5 0 1 0 0 0
    I want to create adjacency list from this matrix which should look like this
        x1 x2
        x1 x4
        x1 x5
        x2 x4
        x3 x5
        x5 x2  
    so After I read matrix from the file : A = LOAD 'matrix.txt' USING PigStorage('\t') AS(x, x1, x2, x3, x4, x5); so DUMP A is now 
        (*,x1,x2,x3,x4,x5) 
        (x1,0,1,0,1,1) 
        (x2,0,0,0,1,0)
        (x3,0,0,0,0,1)
        (x4,0,0,0,0,0)
        (x5,0,1,0,0,0)
    Now I want to create group that maps each x1, x2,x3,x4,x5 of the first column to other columns that have at least one 1 
    Any help appreciated ! 

    Hi Smith_john,
    This one was tricky. Here what I have done to achieve the outcome.
     I remove column name from the dataset. The reason is I will provide column name from pig script.
                    x1 0 1 0 1 1
                    x2 0 0 0 1 0
                    x3 0 0 0 0 1
                    x4 0 0 0 0 0
                    x5 0 1 0 0 0
       2.   On pig grunt shell write below query to load data
           A
    =
    LOAD'/user/pigdata/pigmatrix.txt'
    AS
    (x,x1,x2,x3,x4,x5);
       3.   Replacing with column name where it found 1.
          X
    =
    FOREACH
    A
    GENERATE
    x,
    (x1==1?'x1':''),
    (x2==1?'x2':''),(x3==1?'x3':''), (x4==1?'x4':''), (x5==1?'x5':'')
       4.   Keeping first column as it is, Rest column converted into a bag. Flattening it to make rows
          row_f
    =
    foreach
    X
    generate
    $0
    as
    id,
    FLATTEN(TOBAG($1,$2,$3,$4,$5))
    as
    col2value;
        5.   Filter in record where there is value in second column
    frec =
    FILTER
    row_f
    by
    (col2value
    !=
        6.   Dump records (will print result mentioned in above screen)
                DUMP
    frec;
    Hope it helps. Please mark it answered if it answer your question.
    Thank you for choosing Microsoft HDInsight Service.
    Thanks and Regards,
    Sudhir Rawat

  • Green-bar only works on first matrix in list

    Hi there,
    I used this tutorial (http://blogs.msdn.com/b/chrishays/archive/2004/08/30/greenbarmatrix.aspx) to have a Green-bar effect in my matrix. 
    However I have this matrix placed in a list which is grouped on colour (its for items of clothing) which creates a separate matrix for each colour of item - there can be up to 10 matrices per report coming out of this list. The first matrix for the first list
    item has the green-bar effect, but each subsequent list item matrix does not have the effect. How can I have the green-bar effect occuring for every list item (and thus every matrix?)
    (I am using SSRS 2005)

    Hi SynchFX,
    Based on your description, I create a simple report in my test environment. However, I cannot reproduce the same issue.
    In order to solve your issue more effective, could you please post your dataset with sample data, and the screenshot about report design? It is benefit for us to do further analysis.
    Regards,
    Alisa Tang
    Alisa Tang
    TechNet Community Support

  • Choose From List Condition Problem In Matrix

    Hi,
    I kept CFL for Vendor listing in matrix but if i press tab in the vendor column the BP form Apperas but both the customer record and Vendor records are coming i want only the vendor records to be listed in the CFL of BP so plz tell me the solution for this.
    Madhavi

    Hi,
    Use following query...
    Select CardCode,CardName,cardType  from OCRD Where CardType='S'
    CardType : S for Vendor,C for Customer,L for LEAD
    Regards
    Sanjay

  • User Data source with matrix

    Hi all ,,
    i have a question if you can help me :
    i put choose from list in matrix but when i choose item didn't fill in the column and my code is :
    ** on create form
       oForm.DataSources.UserDataSources.Add("IDS", BoDataType.dt_SHORT_TEXT);
                    SAPbouiCOM.Matrix Mat = (SAPbouiCOM.Matrix)oForm.Items.Item("12").Specific;
                  //  SAPbouiCOM.EditTextColumn EC = Mat.Columns.It
                    Mat.Columns.Item("V_ITM").ChooseFromListUID = "ITM";
                    Mat.Columns.Item("V_ITM").ChooseFromListAlias = "ItemCode";
                    Mat.Columns.Item("V_ITM").DataBind.SetBound(true, "", "IDS");
    ***on Item Event
        if ((pVal.ColUID== "V_4"))
                            //oForm.DataSources.UserDataSources.Item("IDS").ValueEx = val;
                             SAPbouiCOM.Matrix Mat = (SAPbouiCOM.Matrix)oForm.Items.Item("12").Specific;
                      //  SAPbouiCOM.EditTextColumn EC = Mat.Columns.It
                             SAPbouiCOM.EditText c = null ;
                            try
                                 oForm.DataSources.UserDataSources.Item("IDS").ValueEx = val;
                                 Mat.LoadFromDataSource();

    Hi folks, i know this thread is a little old but i have the same insue and i want to share the solution, it could help others.
    Like Mayank said, get line and set line works the last row of the matrix, but is not true at all, GetLineData and SetLineData works for the row of the matrix that is set on the offset of DBDatasource lines, so to works fine you need to set the offset first.
    oForm.DataSources.DBDataSources.Item("@MY_DS_LINES").Offset = x-1;
    Mat.GetLineData(x);
    oForm.DataSources.UserDataSources.Item("IDS").ValueEx = val;
    // Update any other UserDataSources for the same row here...
    Mat.SetLineData(x);
    where x is the row number of the matrix you want to update.

  • Need Help Regarding Enabling The Matrix

    Hi All,
    We have got one user form and we have got one choose from list and one matrix, on click of choose from list the value will be displayed in the text box and at the same time matrix should get enabled. But it;s not happening in our case. The value is coming in the text box through choose from list but matrix is not getting enabled. We are able to change the back ground color of the matrix, make first column invisible and all but not able to enable the matrix. We need help regarding this one.
    Regards,
    Jayanth

    Hey first bind the columns of matrix to any user datasource
    and then you can enter any thing into your matrix 
    following code may help
    suppose you have one column
    oForm = SBO_Application.Forms.Item("URFRM")
    oUserDataSource = oForm.DataSources.UserDataSources.Add("URDSName",
    SAPbouiCOM.BoDataType.dt_SHORT_TEXT, 20)
    oMatrix=oForm.Item("URMATRX")
    oMatrix = oItem.Specific
    oColumns = oMatrix.Columns
    oColumn = oColumns.Item("URCOLName")
    oColumn.DataBind.SetBound(True, "", "URDSName")
    oMatrix.Addrow()
    hope this will help
    additionally you can look at this sample
    .....SAP\SAP Business One SDK\Samples\COM UI\VB.NET\06.MatrixAndDataSources

  • Choose from list for purchase  Item

    Dear Experts,
    i have created Choose from list in matrix using Screen Painter. its working properly but i want to display only Purchase Items in CFL.
    For Customer we are using
    oCons = oCFL.GetConditions()
                oCon = oCons.Add()
                oCon.Alias = "CardType"
                oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL
                oCon.CondVal = "C"
                oCFL.SetConditions(oCons)
    Like this, How to set condition for Purchase items thru coding or Screen painter
    Mathi

    Hi Mathi,
    Try this and tell me if it worked.
    oCons = oCFL.GetConditions()
    oCon = oCons.Add()
    oCon.Alias = "PrchseItem"
    oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL
    oCon.CondVal = "Y"
    oCFL.SetConditions(oCons)
    If this works dont forget to reward points..
    Regards,
    Vasu Natari.
    Edited by: vasu natari on Jul 29, 2008 12:37 PM

  • How to make a choose list with UDF

    Hi,
    I want add a choose list in matrix
    this choose list is a sql
    "SELECT Code,Name FROM ""@SIR_COMPOSANT"" ORDER BY Name" for example
    my code is
                Dim oCFLs As SAPbouiCOM.ChooseFromListCollection
                Dim oCFLCreationParams As SAPbouiCOM.ChooseFromListCreationParams
                Dim oCFL As SAPbouiCOM.ChooseFromList
                oCFLs = oform.ChooseFromLists
                oCFLCreationParams = SBO_application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_ChooseFromListCreationParams)
                oCFLCreationParams.MultiSelection = False
                oCFLCreationParams.ObjectType = "????????"
                oCFLCreationParams.UniqueID = "CFL1"
                oCFL = oCFLs.Add(oCFLCreationParams)
                oform.Items.Item("4").Specific.ChooseFromListUID = "CFL1"
                Dim oEditText As SAPbouiCOM.EditText = oform.Items.Item("4").Specific
                oEditText.ChooseFromListUID = "CFL1"
                oEditText.ChooseFromListAlias = "????????"
    Can you help me please
    Thank you

    didier,
    You do not need the order. On any ChooseFromList, when you open the list itself, you can press the form settings button, and define the default fields and sorting criterias.
    Example
    Open Sales Orders
    press tab on BP Field - this opens CFL of BP
    Press Form Settings icon on toolbar
    Set up the correct fields order and soring values
    Click ok
    You can do the same for your UDO based CFL (when you register UDO, you can define searcable filelds and list of the fields, and positions can be defined there!)
    FYI:
    Also DI Object  SAPbobsCOM.ChooseFromList can be used for defining CFL columns and sort orders, but this is done during UDO registration
    Regards
    J

  • Alphabetize A Matrix Of Words

    hey, i have a matrix with a different word ( string ) in each cell. I need those to come out in alphabetical order and i cant think of a way how. Any help? Thanks
    Example:
    Matrix:
    {jon,abby,a
    ,dave,brian,largo};
    and i want it to print
    "a abby brian dave jon largo"
    I dont need to change the matrix, i just need to get the information out in alphabetical order.

    This is part of a really big program that i am not
    using array lists for. Is there any other way to do
    it with matricies or do i have to go back and convert
    everything to arraylists. If thats the case than ill
    just take the hit of some points because thats gonna
    take forever. I am done with the whole program and
    this is the only thing left to do.You don't have to change the matrices, you're just using the ArrayList to do the sorting for you. Step 1 was copying the values from the matrix into the List; the matrix is unchanged. If all you want to do is print them out alphabatized, then trash the List afterwards. If you want to keep them in sorted order, then hang onto the List. If you want to put them back into the matrix in sorted order, then you'll have to decide how to do that.

Maybe you are looking for

  • Address Book Sync Overtaking my RAM

    For a while now I have had issues with Address Book / Contacts on my Macbook (2011, 13" 2.8 GHz / 4gb RAM). I keep a large number of contacts (2,500-3,500 - it's lower these days) that I need to have access to on my other devices, so I realize that m

  • Third Party Dll (WinSCP) throwing runtime error in script task

    Hi, I am trying to implement  SFTP automation in SSIS.  I used winscp assemblies to achieve this task.  During compile time, I have no errors. When i try to run it, i am getting  below runtime error (Refer image).   So i tried to install the assembly

  • Mac OS X 10.6.8 to OS X Mountain Lion possible?

    I have a late 2010 macbook air with Mac OS X 10.6.8, Was wondering what do I need to be able to download the new OS X Mountain Lion? Thanks Grace x

  • How to make a menu for MHP

    Hi, im trying to make a menu for mhp app, and i dont know what its the best 'tactic' for this. My idea is to make own class like this: class Menu extends HContainer      private Font fuente;      private Color colorLetra, colorFondoTexto, colorFondo;

  • Update Combobox problem

    Hi, I have a jsp-page with two frames. The leftone has values from the database with a combobox and in the left one you could insert values to the database. My problem is that when adding values in the right frame to the database the right frame will