get itemcodes from matrix in one string

Hi ,

i'm trying to create a link with all the itemcodes from an offer.
The links is : http://website.com/dl?sku=A10001,A10002

this part is fixed: http://website.com/dl?sku=
But then the second part should be populated with the Itemcodes from the matrix.

I'm using similar code to open a track and trace link but this only has 1 value added in the url.

Try
    Dim sShipping As String = TextEdit.GetFromUID(pVal.Form, "251").Value.ToString
    StatusBar.WriteSucess(" sShipping : " & sShipping)    
    Dim gls As String = "https://gls-group.eu/BE/vl/pakket-volgen?match="
    Dim url As String = gls & sShipping
    System.Diagnostics.Process.Start(url)
    
    
Catch ex As Exception
    MessageBox.Show("Probleem bij het oproepen van de Track & Trace Link: " & ex.Message, "OK")
End Try

So can someone show me how to get the Itemcode from the matrix into a string with , separation
0

Comments

2 comments
  • Official comment

    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

    Comment actions Permalink
  • this works great 

    Thanks

    0
    Comment actions Permalink

Please sign in to leave a comment.

Didn't find what you were looking for?

New post