Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
They always move the goal-posts, don't they
Message
De
05/07/2005 10:27:45
 
 
À
05/07/2005 09:51:59
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
01028919
Message ID:
01028988
Vues:
10
Thanks for that Dragan. Again, I suspected I'd have to do something as nasty, involved and faffy as this, but was hoping someone would say something like "Use the VFP ConvertTheirDataToYoursInAnyFormat() function" Suppose I'll have to wait for VFP 12 for that! :-)

Terry

>I've dealt with this before. The major point in the app was a huge import file which came from an external app that I had no control over. Worse: I never knew what these guys would do next.
>
>So I had a metadata table. Their field name, my field name, my table name (i.e. their data were highly denormalized, and contained lists within a field etc - so I exported into several tables), field type, field len (don't remember if I had any decimals anywhere), conversion function.
>
>Before import, I'd read the header, split it into the field names (alines() with a tab for field separator - in your case it'd be the bar). Then I'd go down my metadata table and match these fields to it, and generate a cursor with appropriate structure (if not found, FLDnnn c(10)). Then I'd append into that cursor. The nice thing was that if any fields weren't there, nothing would happen.
>
>In the second phase I'd generate code to write into the record(s) of the target table(s) - which meant that no code was generated for absent fields. I've once calculated that just this "no code generated for absent fields" eliminated about 40000 if/endifs, because the code wouldn't have to check for each of those fields for each record. What was there was there, what wasn't wasn't.
>
>There was one trick to the generated code: the conversion functions were actually methods of the converter bizobject, and the bizobject would pass itself as a parameter. So the code would look like
>
>
lparam oThis
>oThis.CharToDate(curImportTemp.cDate, "bigimporttable.dDate")
>oThis.JustCopy(curImportTemp.cName, "bigimporttable.cName")
>...
- Whoever said that women are the weaker sex never tried to wrest the bedclothes off one in the middle of the night
- Worry is the interest you pay, in advance, for a loan that you may never need to take out.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform