Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Non data bearing primary keys
Message
From
13/06/1998 17:11:11
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00106667
Message ID:
00107936
Views:
25
>Here's a simplified version of how I append in my data:
>
>*- Update Source Tables with New Data
>SELECT FileListCursor
>GO TOP
>DO WHILE NOT EOF()
>   SCATTER FIELDS SystemCode, Ref_num MEMVAR   &&Note-FPW2.6 Current Platform
>   m.Filename = m.SystemCode+"filesuffix.fla"
>   && some code to verify m.filename exists and handle if missing or old
>   SELECT SourceDataTable
>   APPEND FROM (m.FileName)TYPE DELI
>   REPLACE ALL ref_num WITH m.ref_num FOR EMPTY(ref_num)
>   &&This Was where my test called UDF to generate Non-Data PKs
>   SELECT FileListCursor
>   SKIP
>ENDDO
>
>*- Begin Source Table Specific Data Manipulation
>
>
>(ok my fingers are crossed here gang, and I'm hoping all the gurus out there don't make me start thinking about how to rewrite my whole framework after seeing this message) =D)

No, it's just what was proposed here already. Instead of "&& This Was", you could just put this:
Replace All PK with Gimme_Pk() for empty(PK)
where gimme_pk is a function which delivers the new value of the PK. Case closed.
If you're sure you have to do this for new records only (you seem to be adding records from more *.fla files), you could fill the PKs only once, when you exit this loop, or

_rcn=recc()+1
APPEND FROM (m.FileName)TYPE DELI
if _tally>0
go _rcn
REPLACE REST ref_num WITH m.ref_num FOR EMPTY(ref_num)
go _rcn
Replace REST PK with Gimme_Pk() for empty(PK)
endif

This isn't greatly different, but might speed things up a little.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform