Snippets

SeanB Reshape - Dataflex function

Created by SeanB

Function Reshape Variant[] aInpBlock Integer hObj Integer iMsg  Returns Variant[][]
    Variant[][] aBlock
    Integer iPos 
    Integer iMax 
    Integer iGrp 
    Integer iFld 
    Integer iTest 
    
    Move (SortArray(aInpBlock,Self,iMsg)) to aInpBlock
    Move (SizeOfArray(aInpBlock)) to iMax
    If (iMax=0) Function_Return aBlock 
    
    Move aInpBlock[0] to aBlock[0][0]
     
    For iPos from 1 to (iMax-1) 
        Get iMsg of hObj aInpBlock[iPos] aInpBlock[iPos-1] to iTest 
        If (iTest=EQ) Begin 
            Move (iFld+1) to iFld 
        End
        Else Begin 
            Move (iGrp+1) to iGrp 
            Move 0 to iFld 
        End
        
        Move aInpBlock[iPos] to aBlock[iGrp][iFld]
    Loop
    
    Function_Return aBlock 
End_Function

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.