Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to keep Grid contents sorted on RecordSource field
Message
From
21/05/2003 08:57:25
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
21/05/2003 08:46:33
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00790972
Message ID:
00791010
Views:
20
>Cetin,
>
>No, actual DD_earappdwg.rd_dsort field is built from two table fields from foreign key (joined) table DD_dwgh. DD_dwgh.dh_dwgnum + DD_dwgh.dh_rev (both Char fields).
>
>The problem from your solution as I see it, is that the ChildOrder property of Grid (from my understanding) must match exactly the field data value from RelationalExpr field from LinkMaster (parent) table.
>
>NOTE: ar_rcn, and rd_rcn are Integer data type fields.
>
>Parent table, RelationalExpr field is: DD_ear.ar_rcn
>You've made ChildOrder as: DD_ear.mysorter (rd_rcn+rd_dsort)
>
>Wouldn't this corrupt the exact match link from Child to Parent table for grid contents?
>
>Fz

No it doesn't corrupt (set exact off - default setting). Relation needs to satisfy find a match, and it doesn't care about the characters after match is found. ie:

table1 : cust_id c(5) primary key && Familiar :)
table2 : cust_id c(5), order_id i, order_date d

I want to see all orders of a customer but with sort on date (want to see last order first) :
Table2 :
Index on cust_id+dtoc(order_date,1) tag mySorter descending
use Table2 in 0 order tag mySorter
use Table1 in 0
select Table1
set relation to cust_id into Table2
Or simply w/o setting a relation :
.LinkMaster = 'Table1'
.RelationalExpr = 'cust_id'
.ChildOrder = 'mySorter'

IOW you need a key which has the part that would satisfy relation in front and then your sort order.

Another alternative would be to use either a sorted cursor or a view without a relation (SQL or View parameters would provide the relation)

Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform