4DToday.com
4D Web 2.0 Pack v11 Release 1
Home Directory Classifieds Reference Archives
Site Info
About 4DToday.com
Contact Us
Version française
Quote
Developers (695)
4D Developers (575)
Web Developers (320)
Tools Publishers (187)
Instructors (162)
Web Hosts (54)
Resellers (80)
Software Publishers (285)
Search Developers
Products (416)
Plug-Ins (125)
Components (61)
Code Libraries (9)
Books (9)
Tools (42)
Vertical Applications (144)
Search Products
User Groups
All User Groups (20)
Classified Ads (5)
Help Wanted (2)
Opportunities Wanted (3)
Hardware Wanted (0)
Hardware for Sale (0)
Software Wanted (0)
Software for Sale (0)
Other (0)
Resources
4D
4D, Inc.
4D International
4D Wiki
4D Partner Central
4D Beginner's Center
4D Online Documentation
4D 2004 Example Applications
4D Example Databases
4D BugDisplayer
4D, Inc. Training
Message Lists
4D Mailing Lists
4D Tech Google Group
iNUG Archives (Nabble)
iNUG Archives (Gmane)
iNUG Message Index
Other
4D Code Exchange
4D Resources
Sviluppo4D.it (Italy)
Quote
The difference between pornography and erotica is lighting.
Gloria Leonard  
  Suggest a Quote  
Developer News
New 4D Tech Note Posted
This week's Technical Note that discusses the API calls and classes allowing for easy CSS manipulation is now available to 4D Partners. Yesterday
Weekly Tech Tips Posted
The weekly tech tips for the week of May 5th have been posted to the 4D, Inc. Web site. Some of the subjects this week include "Caps Lock indicator displayed during activation," "Obtaining element references in JavaScript," and "How to make Fields searchable in a Data Grid." Yesterday
 Submit Future News    Archive 
Technical Tip
Sort Selection on a Field from a Related Table
Submitted by Milan Adamov, YU Epicentar

The method below sorts the selection of the Many table based on a field from the One table. Method assumes that there is automatic many to one relation between two tables. If you have manual relation between them, you can activate automatic relations at the beginning of the method and turn them off at the end. For example, if you have  a Longint field that links from [Invoices] to [Customers] and you want to sort the selection of [Invoices] by name of the customer you call this method as follows:

SORT_SortOnExternalTableField(->[Invoices]; ->[Customers]CustomerName)

` Method SORT_SortOnExternalTableField(Pointer;Pointer)

C_POINTER($1;$SortBaseTable_ptr;$2;$SortColumnField_ptr)
C_LONGINT($3;$Direction_l;$FieldType_l)
C_BOOLEAN($MakeSelection_b)

ARRAY LONGINT($RecNums_al;0)
ARRAY TEXT($ToSort_at;0)
ARRAY LONGINT($ToSort_al;0)
ARRAY INTEGER($ToSort_ai;0)
ARRAY REAL($ToSort_ar;0)
ARRAY DATE($ToSort_ad;0)
ARRAY BOOLEAN($ToSort_ab;0)

$SortBaseTable_ptr:=$1
$SortColumnField_ptr:=$2
If (Count parameters>2)
  $Direction_l:=$3
Else
  $Direction_l:=0
End if

$FieldType_l:=Type($SortColumnField_ptr->)
$MakeSelection_b:=True

Case of
  : ($FieldType_l=Is Integer )
    SELECTION TO ARRAY($SortBaseTable_ptr-> ;$RecNums_al;$SortColumnField_ptr-> ;$ToSort_ai)
    If ($Direction_l=0)
      SORT ARRAY($ToSort_ai;$RecNums_al;>)
    Else
      SORT ARRAY($ToSort_ai;$RecNums_al;<)
    End if
   
  : ($FieldType_l=Is LongInt ) | ($FieldType_l=Is Time )
    SELECTION TO ARRAY($SortBaseTable_ptr-> ;$RecNums_al;$SortColumnField_ptr-> ;$ToSort_al)
    If ($Direction_l=0)
      SORT ARRAY($ToSort_al;$RecNums_al;>)
    Else
      SORT ARRAY($ToSort_al;$RecNums_al;<)
    End if
   
  : ($FieldType_l=Is Alpha Field ) | ($FieldType_l=Is Text )
    SELECTION TO ARRAY($SortBaseTable_ptr-> ;$RecNums_al;$SortColumnField_ptr-> ;$ToSort_at)
    If ($Direction_l=0)
      SORT ARRAY($ToSort_at;$RecNums_al;>)
    Else
      SORT ARRAY($ToSort_at;$RecNums_al;<)
    End if
   
  : ($FieldType_l=Is Real )
    SELECTION TO ARRAY($SortBaseTable_ptr-> ;$RecNums_al;$SortColumnField_ptr-> ;$ToSort_ar)
    If ($Direction_l=0)
      SORT ARRAY($ToSort_ar;$RecNums_al;>)
    Else
      SORT ARRAY($ToSort_ar;$RecNums_al;<)
    End if
   
  : ($FieldType_l=Is Date )
    SELECTION TO ARRAY($SortBaseTable_ptr-> ;$RecNums_al;$SortColumnField_ptr-> ;$ToSort_ad)
    If ($Direction_l=0)
      SORT ARRAY($ToSort_ad;$RecNums_al;>)
    Else
      SORT ARRAY($ToSort_ad;$RecNums_al;<)
    End if
   
  : ($FieldType_l=Is Boolean )
    SELECTION TO ARRAY($SortBaseTable_ptr-> ;$RecNums_al;$SortColumnField_ptr-> ;$ToSort_ab)
    If ($Direction_l=0)
      SORT ARRAY($ToSort_ab;$RecNums_al;>)
    Else
      SORT ARRAY($ToSort_ab;$RecNums_al;<)
    End if
   
  Else
    $MakeSelection_b:=False
End case

If ($MakeSelection_b)
  CREATE SELECTION FROM ARRAY($SortBaseTable_ptr-> ;$RecNums_al)
End if
  Submit a Tip    Archive 
Spotlight
eFax
eFax eFax is an online fax service that eliminates the need for a fax machine, an extra fax line and all the associated expenses (paper, ink cartridges etc.). Get a real fax number that's tied to your email. Send and receive faxes as email attachments. It's all the reliability and security of faxing with the ease and convenience of email.
  Suggest a Spotlight  
Survey Question
Today, we ask you...
Are you using 4D View?
Yes
Not yet, but soon
I was, but stopped
No plans to use it

Survey submitted by Peter de Groot
  Show Results (no vote)    Suggest a Survey  
Events
There are no events scheduled for the upcoming week.
  Submit an Event