Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Scan/scanfor
Message
From
17/03/2009 16:46:12
 
 
To
17/03/2009 16:26:21
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
01388826
Message ID:
01388832
Views:
81
>I don't know how to explain this real well:
>This is what I have:
>USE D:\Work\client\fossil_creek\lanproconversion1\for_luigi\use\stage5\legals.dbf In 0 Shared Again
>USE D:\Work\client\fossil_creek\lanproconversion1\for_luigi\use\stage5\leases.dbf In 0 Shared Again
>UPDATE leases SET leases.legal_desc = "Tract: " + TRIM(legals.tract_id) + CHR(13) + TRIM(legals.township) + CHR(32) + TRIM(legals.range) + CHR(32) + TRIM(legals.section) + CHR(13) + TRIM(legals.tract) ;
> FROM leases INNER JOIN legals ON Lower(Alltrim(leases.lease_id)) == Lower(Alltrim(legals.lease_id))
>
>What I want it to get the tract legal descriptions into the lease legal desciptions, but in many cases there is more than one tract per lease. I would like to see the descriptions of each tract associated with a lease. What do I do?

One approach (pseudocode):
* SCAN all leases:
SELECT Leases
SCAN ALL
  m.Lease_ID = Leases.Lease_ID

  * Get all rows of Legals table matching the current lease to a temp cursor:
  SELECT ;
    * ;
    FROM Legals ;
    WHERE Lower(Alltrim(legals.lease_id)) == m.Lease_ID ;
    INTO CURSOR LeaseLegals

  * Build up a character string memvar with info for all Legals for the current Lease:
  m.TractInfo = ""
  SELECT LeaseLegals
  SCAN ALL
    m.TractInfo = m.TractInfo ;
      + (however you want to build up the string/memo here)

  ENDSCAN

  USE IN LeaseLegals

  * Update the current lease:
  UPDATE Leases ;
    SET legal_desc = m.TractInfo ;
    WHERE Lower(Alltrim(legals.lease_id)) == m.Lease_ID 

ENDSCAN
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform