Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Accused of violations I'm not committing
Message
 
 
À
04/02/2005 07:56:19
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
00983795
Message ID:
00983801
Vues:
18
Try
lnZoneNo = INT(VAL( ZONENO))
Btw, what's zone field type/size in the allzones table?

>
>Sort this one out for me, will you, while I'm off on a weekend's break in
>my old home town of Liverpool :-)
>
>I'm importing a text (CIF) file of bus stops into my VFP database.
>I have a table of Zones (ALLZONES) that holds details of the zones already in the database.
>Each stop has to be located in a Zone, but the text file doesn't map them. So I have an XLS where Stop Nos are mapped-vs-Zone nos. (NOT there may be several
>stops nos mapped against the same zone, i.e. several stops in one geog. zone)
>I APPEND FROM the XLS into a cursor, csrSZ, which I've already created, thus:
>
>Create Table csrSZ ( StopLocn c ( 12) Primary Key, ZoneNo c( 6), Eastings c(6), Northings c(6), Desc c(50))
>
>Now there are some zones in the cursor that don't already exist in ALLZONES, so,
>I first go through the cursor and create them on-the-fly, so that the import of
>the stops will not be impeded by lack of zone. With each one thus created I
>report it to an exception log (don't worry about this), as below:
>
>
>
>Select ALLZONES
>Set Multilocks on
>= CURSORSETPROP( "Buffering", 5, "ALLZONES")
>llAditions	= .F.
>Select csrSZ
>SCAN
>  lnZoneNo	= VAL( ZONENO)
>  If not INDEXSEEK( lnZoneNo, .F., "ALLZONES", "ZONE")
>      llAditions	= .T.
>      Insert into ALLZONES	( ZONE) Values ( lnZoneNo)	
&& create just Zone skeleton so can import this rec.
>      Thisform.lmCIFError( "N/A", (thisform.cStopsZonesLU), STR( lnZoneNo, 4), ;
>	  	  	"WARNING: Missing Zone Record 'skeleton' added from Look-up.")
>  EndIf
>ENDSCAN
>At the insert I get a "Uniqueness of index ZONE is violated" message.
>At the time, lnZoneNo = 9046.00.
>As you can see, it's just passed the INDEXSEEK() test FOR this value!
>However, the previous zoneno., in csrSZ was 9013.00 (and there were several of
>them)
>
>When I look at my ALLZONES table, I find 2 new recs both with 9013 as the zone.
>Obviously only the 1st should have passed the test.
>If I click on one of these new recs I get ordered to revert, as you'd expect.
>
>So this all leads me to think that VFP's objecting to the 9013 and not the 9046,
>although, at the insert line I'm trying to insert 9046. And how the hell did 2
>9013's get in.
>
>
>FYI the last previoius rec was 9011, but some goon in the past had inserted a
>dummy zone of 9999, which RI won't let me delete. I don't know if this would have
>any bearing.
>
>
>There's another problem in that, as there's no autoincrement on keys in V7, I
>have a function NewID(), on the Zone key, as default value, to get me the next
>incremental zone no when I'm creating them manually on the Zones form. It keeps
>a counter in a Counters table (the usual stuff!). For the purposes of this
>exercise I've temp. taken the NewID() off the table, as I thought, naturally,
>this would screw it up good and proper. Now I can do this, in dev., but how
>would I get around this in the live system?
>
>As "The Mask" said, "Somebody HELP me!" ... please
>
>'ppreciate it.
>
>Terry
>
>PS I won't be able to respond till Monday as I'm off in half an houtr
>
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform