Sign in to follow this  
Followers 0
Private

Finally: Array2dToClip

1 post in this topic

Dear all,

I have been needing this function for a LONG time because i'm busy creating severel programs for my work.

now for example i'm creating an import module to the database; this is using multiple fields in once where i need to store more values for example:

Dim $a_Record_1[15][6]
    $a_Record_1[0][0] = "TableName"
    $a_Record_1[0][1] = "FieldName"
    $a_Record_1[0][2] = "FieldValue"
    $a_Record_1[0][3] = "FieldLength"
    $a_Record_1[0][4] = "FieldScale"
    $a_Record_1[0][5] = "FieldType"

    $a_Record_1[1][0] = "T_EDI_DOSSIERS"
    $a_Record_1[1][1] = "DOSSIERNUMMER"
    $a_Record_1[1][3] = ""
    $a_Record_1[1][4] = ""
    $a_Record_1[1][5] = ""

    $a_Record_1[2][0] = "T_EDI_DOSSIERS"
    $a_Record_1[2][1] = "EDI_REFERENTIE"
    $a_Record_1[2][3] = ""
    $a_Record_1[2][4] = ""
    $a_Record_1[2][5] = ""

    $a_Record_1[3][0] = "T_EDI_DOSSIERS"
    $a_Record_1[3][1] = "DOSSIERAFDELINGCODE"
    $a_Record_1[3][3] = ""
    $a_Record_1[3][4] = ""
    $a_Record_1[3][5] = ""
p.s. this is followed by a database lookup so the empty variables are not useless :-)

When i'm debugging my application it's hard to get it all the time in a textbox for example $a_Record_1[3][3] because _ArrayDisplay has its restriction to a 1dimensional array.

then I came with the idea to get a handy udf that copys it to my clipboard.

Everybody is absolutely free to use it. most of credits go to brian because i ripped half his script for _arraydisplay.

;===============================================================================
;
; Function Name:  _Array2dToClip()
; Description:  ClipPut a 2-dimensional array.
; Author(s):      Daryl Peeters <darylpeeters at hotmail dot com>
;
;===============================================================================
Func _Array2dToClip(Const ByRef $avArray)
    Local $iCounter = 0, $sMsg = "", $xCounter = 0

    For $iCounter = 0 To UBound($avArray) - 1
        for $xCounter = 0 to Ubound($avArray, 2) -1
            $sMsg = $sMsg & "[" & $iCounter & "]["& $xCounter & "]  = " & StringStripCR($avArray[$iCounter][$xCounter]) & " "
        Next
        $sMsg = $sMsg & @CRLF
    Next

    ClipPut($sMsg)
EndFunc  ;==>_ArrayToClip

All the best.

Share this post


Link to post
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0