Skip to main content

get itemcodes from matrix in one string

Comments

2 comments

  • Official comment
    Karsten Amrein

    Hi Tom,

    you need to loop through the matrix as below:

    Dim ruleName As String = pVal.RuleInfo.RuleName
    Dim errorMessage As String = "Error in Function Button Rule '" + ruleName + "'"
     
    Try
        Dim base As String = "http://website.com/dl?sku="
        Dim url As String = base
        
        'Run trough all rows
        Dim m As Matrix = Matrix.GetFromUID(pVal.Form, "38")
        For i As Integer = 0 To m.Rows.Count - 1
            Dim itemCode As String = m.GetValue("1", i)
            If Not String.IsNullOrEmpty(itemCode) Then
                url = url + m.GetValue("1", i) + ","
            End If    
        Next
        
        If url.Trim().Substring(url.Length - 1, 1) = "," Then
            url = url.Trim().Substring(0, url.Length - 1)
        End If    
            
        MessageBox.Show(url, "ok")
        
    Catch ex As Exception
        customize.Messaging.StatusBar.WriteError("Error in coresuite customize Rule: " & ex.ToString())
        customize.Messaging.Debug.WriteMessage("Error in coresuite customize Rule: " & ex.ToString(), customize.Messaging.Debug.DebugLevel.Exception)    
    End Try

    Please check and feel free to customize the rule as necessary for the purpose. 

     

    Best Regards

    Karsten Amrein

  • Tom Thys

    this works great 

    Thanks

    0

Please sign in to leave a comment.