Paradox Community

Items in pnews.paradox-programming

Subject:Re: Code help please
Date:9 May 2021 22:47:20 -0400
From:"Kevin Zawicki" <numberjack@wi.rr.com>
Newsgroups:pnews.paradox-programming

Any reason you need to do one year at a time? Performance?

This is a rough out, but basically:

Set a block of code that runs a(same) query than adds answer to your destination
table.
Run that block 5 times in a for loop adjusting the date range using a string
variable in the query.




var
 yCnt smallInt
 qry   query
endvar

qry = 

Query

XrunJM.DB | Type                 | RaceNo       | 
          | Check UK Flat | Check _join1 | 

XrunJM.DB | Date                   | Type of Race | 
          | Check _join2, ~myYears | Check             | 

XrunJM.DB | Horse Name | Sex       | Age     | Weight | Blinkers | Position
|
   	      | Check             | Check  | Check  | Check  | Check    | Check
   | 

XrunJM.DB | Distance Beaten | BHB Rating | RFM Rating | Speed  | sp     |
                     | Check           | Check      | Check      | Check
 | Check  | 

XrunJM.DB | Trainer | Jockey | Allow  | FIELD028      | 
   	      | Check   | Check  | Check  | Check as Draw | 

xraceJM.DB | Raceform Number | Date   | Pub Time | Condition  | Track   
   | 
   	       | _join1          | _join2 | Check    | Check Hcap | Check ..GB..
|

xraceJM.DB | yds    | Value 1st | Type of Jockey | Type of RaceB | 
			  | Check  | Check     | Check          | Check     

xraceJM.DB | Age Condition | RAN    | Class  | 
			  | Check         | Check  | Check  | 

EndQuery






;//run same query and add 5 times.


;// step your year date range
;// maybe a start year smallInts   yr = 2018  and month = 3
;// many ways to do this
Yr = yr + 1 ;// increment year

Something like this

myYears = “>=01/01/” + yr.string() + “,<=31/12/” +yr.string()   

myYears.view()    ;//use to verify string

;//then build your date range a string


for yCnt from 1 to 5
 myYears = “>=01/03/2019,<=31/12/2019”   
 qry.executeQBE(“:PRIV:answer.db”)

 tbl.attach“:PRIV:answer.db”)
 tbl.add(":myAlias:Stats5",True,False)
endfor








"Tony spencer" <tracy.fairbrother@btopenworld.com> wrote:
>
>
>Please can someone help. I want to query some data for 6 years 
>I want to do one one year at a time then add the answer to stats 5. can
someone
>help me with the code please. Thanks Tony
>
>
>
>method run(var eventInfo Event)
>
>var
>
>	 tab table
>  tc tCursor
>
>
>	qb Query
>
>
>	endVar
> 
>
>			  qb=Query
>ANSWER: C:\Program Files\Corel\Shared\Private\1.DB
>
>XrunJM.DB | Type          | RaceNo       | 
>			 | Check UK Flat | Check _join1 | 
>
>XrunJM.DB | Date                                   | Type of Race | 
>			 | Check _join2,>=01/03/2019,<=31/12/2019 | Check        | 
>
>XrunJM.DB | Horse Name | Sex    | Age    | Weight | Blinkers | Position
|
>
>			 | Check      | Check  | Check  | Check  | Check    | Check    | 
>
>XrunJM.DB | Distance Beaten | BHB Rating | RFM Rating | Speed  | sp    
|
>
>			 | Check           | Check      | Check      | Check  | Check  | 
>
>XrunJM.DB | Trainer | Jockey | Allow  | FIELD028      | 
>			 | Check   | Check  | Check  | Check as Draw | 
>
>xraceJM.DB | Raceform Number | Date   | Pub Time | Condition  | Track  

>    | 
>			  | _join1          | _join2 | Check    | Check Hcap | Check ..GB.. |
>
>
>xraceJM.DB | yds    | Value 1st | Type of Jockey | Type of RaceB | 
>			  | Check  | Check     | Check          | Check         | 
>
>xraceJM.DB | Age Condition | RAN    | Class  | 
>			  | Check         | Check  | Check  | 
>
>EndQuery
>
>
>
>  qb.executeQBE()
>
>	tab.attach("1")
>tab.add("Stats5",True,False) 
>			  
>
>
>
>
>
>
>
>
>
>
>
>
>
>	endMethod
>
>


Copyright © 2004 thedbcommunity.com