4DToday.com
Transax Payment Processing for 4D
Home Directory Classifieds Reference Archives
Site Info
About 4DToday.com
Contact Us
Version française
Quote
Developers (721)
4D Developers (597)
Web Developers (339)
Tools Publishers (197)
Instructors (166)
Web Hosts (60)
Resellers (86)
Software Publishers (298)
Search Developers
Products (406)
Plug-Ins (121)
Components (62)
Code Libraries (9)
Books (7)
Tools (42)
Vertical Applications (147)
Search Products
User Groups
All User Groups (22)
Classified Ads (11)
Help Wanted (4)
Opportunities Wanted (7)
Hardware Wanted (0)
Hardware for Sale (0)
Software Wanted (0)
Software for Sale (0)
Other (0)
Resources
4D
4D, Inc.
4D Wiki
4D Partner Central
4D Knowledgebase
4D Doc Center
Example Applications
4D BugDisplayer
4D, Inc. Training
Podcasts on 4D
Message Lists
4D Bulletin Board
4D-Forum
4D Mailing Lists
4D Tech Google Group
iNUG Archives (Nabble)
iNUG Archives (Gmane)
Other
4D Code Exchange
4D Resources
Sviluppo4D.it (Italy)
Quote
Live out of your imagination, not your history.
Stephen R. Covey  
  Suggest a Quote  
Building Shared Components from Scratch
All sessions this year will focus on 4D v12 and 4D v11 SQL, meaning you can use everything you learn right away. Don't miss out on sessions like "Building your first shared form component from scratch". Would you like to know more? Monday
Bright Minds Brought Together
Monitors, laptops, and a bunch of devs geeking out about 4D. Yes, the Unconference event at the 4D Summit is back! Would you like to know more? Monday
Save on your Hotel Room
There is one week left to save on your 4D Summit hotel room! Would you like to know more? Monday
 Submit Future News    Archive 
Technical Tip
Transform 2D array mxn to nxm
Submitted by Garri Ogata, in8software

//Method: Core_2DArray_Transform(p2DArraySource;p2DArrayDestination;
//      {nSourceStartColumn;nSourceStartRow})
//Description:  This method transforms  source  (CxR) to destination (RxC)
//    starting from the sources Column and Starting Row.  The destination array
//    must come in properly sized.

//    EX  Source (2x3)  Destination (3x2)
//    src   a  d      dst  a   b   c   
//            b  e             d   e  f
//            c  f


C_POINTER($1;$2;$p2DaSource;$p2DaDestination)
C_LONGINT($3;$4;$nSourceStartColumn;$nSourceStartRow;$nDestinationColumns;$nDestinationRows)
C_LONGINT($nNumberOfParameters;$nColumn;$nRow)

$p2DaSource:=$1
$p2DaDestination:=$2

$nSourceStartColumn:=1
$nSourceStartRow:=1

$nNumberOfParameters:=Count parameters

If($nNumberOfParameters>2)
  $nSourceStartColumn:=$3
  $nSourceStartRow:=$4
end if

$nDestinationColumns:=Size of array($p2DaDestination->)
$nDestinationRows:=Size of array($p2DaDestination->{1})

For ($nColumn;1;$nDestinationColumns)
  For ($nRow;1;$nDestinationRows)
    $p2DaDestination->{$nColumn}{$nRow}:=$p2DaSource->{$nSourceStartColumn}{$nSourceStartRow}
    $nSourceStartColumn:=$nSourceStartColumn+1  //Go to the next column
  End for

  $nSourceStartColumn:=$nSourceStartColumn-$nDestinationRows  //Reset the source start column to its original setting
  $nSourceStartRow:=$nSourceStartRow+1  //Go to the next row
End for
  Submit a Tip    Archive 
Spotlight
LinkedIn
LinkedIn LinkedIn is an online network of more than 13 million experienced professionals from around the world, representing 150 industries. Create your profile today and find former and current colleagues and clients. It's a great way to network with your connections as well as their connections.
  Suggest a Spotlight  
Survey Results
This weekend, we asked you...
Are you coming to the summit?
Survey Results

Your vote: (no vote)
Total votes received: 163
  Suggest a Survey  
Events
There are no events scheduled for the upcoming week.
  Submit an Event