Click here to Skip to main content
14,635,966 members
Rate this:
Please Sign up or sign in to vote.
See more:
Hi All !
I have a problem about the time the insured (database: FOXPRO) example:
Table1:
fullname  | begindate  | enddate  | printdate	
-----------------------------------------------------
John   |  01/10/2013  |  30/09/2014  |  28/09/2013
John   |  01/12/2015  |  30/09/2016  |  28/11/2015
Mery   |  01/01/2010  |  31/12/2012  |  27/05/2011
Mery   |  01/01/2013  |  30/12/2013  |  29/12/2012
Tom    |  01/01/2010  |  31/12/2012  |  27/05/2011
Tom    |  01/09/2012  |  30/12/2013  |  29/08/2012
-----------------------------------------------------


how to put the time constant on the new table
constant time,intermittent time of John, Mery, Tom ?

Thanks !

What I have tried:

Fields: Begindate -> Start date insured
Fields: Enddate -> End date insured

This mean: per person per year are granted a one-time card, calculate the time constant and intermittently since engaged until the end.
Exp:
John 
  + insured:     {01/10/2013-30/09/2014} (first year)= 12 month
  - not engaged: {01/10/2014-30/11/2015}             = 14 month
  + insured:     {01/12/2015-30/09/2016} (last year) = 10 month

-> no ongoing involvement
----------------------------------------
 Mery
  + insured: {01/01/2010 - 31/12/2012} (first year)= 36 month
  + insured: {01/01/2013 - 30/12/2013} (last year) = 12 month

-> ongoing involvement = 36 + 12 = 48 month
----------------------------------------
Tom
  + insured: {01/01/2010-31/12/2012} (first year)= 36 month
  + insured: {01/09/2012-30/12/2013} (last year) = 16 month

-> ongoing involvement = 36 + 12 = 48 month (not=36+16)
----------------------------------------

I want to show all the results to other .DBF file
I don't know how to write the command in FoxPro ?

I tried using the array to calculate given the results but is not, we're looking for help for code. Thanks a lot !
Posted
Updated 27-Oct-16 3:38am
v4

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 2

Fields: Begindate -> Start date insured
Fields: Enddate -> End date insured

This mean: per person per year are granted a one-time card, calculate the time constant and intermittently since engaged until the end. 
Exp: 
 John 
  + insured:     {01/10/2013-30/09/2014} (first year)= 12 month
  - not engaged: {01/10/2014-30/11/2015}             = 14 month
  + insured:     {01/12/2015-30/09/2016} (last year) = 10 month

-> no ongoing involvement
----------------------------------------
 Mery
  + insured: {01/01/2010 - 31/12/2012} (first year)= 36 month
  + insured: {01/01/2013 - 30/12/2013} (last year) = 12 month

-> ongoing involvement = 36 + 12 = 48 month
----------------------------------------
Tom
  + insured: {01/01/2010-31/12/2012} (first year)= 36 month
  + insured: {01/09/2012-30/12/2013} (last year) = 16 month

-> ongoing involvement = 36 + 12 = 48 month (not=36+16)
----------------------------------------

I want to show all the results to other .DBF file 
I don't know how to write the command in FoxPro ?

Thanks a lot !
   
v2
Comments
Patrice T 27-Oct-16 23:28pm
   
I updated your question, you can delete this.
Use Improve question to update your question.
songoku2009 2-Nov-16 4:43am
   
*-----------------------------------------------------------
*------------------|< BEGIN >|-------------------------
*-----------------------------------------------------------
CLOSE DATABASES
CLOSE ALL
CLEAR ALL
CLEAR
SET DATE FRENCH
SET CENTURY ON
SET TALK OFF
SET EXACT OFF

*-----------------------------------------------------------
*------------------|< BODY CODE >|-----------------
*-----------------------------------------------------------
*/--- available ---/
*---------------------------------------------------/
DIMENSION ht(30),tu(30),den(30)
j=0

*/--- Find 01 persion to array ---/
*---------------------------------------------------/
USE pc
stop = RECCOUNT()
USE IN pc

FOR i = 1 TO stop
USE pc
j = i
Go j
ht(j) = alltrim(htns)
tu(j) = gtri_tu
den(j)= gtri_den

LOCATE FOR htns = ht(j)
DO WHILE FOUND()
j = j + 1
SCATTER fields gtri_tu TO tu(j)
SCATTER fields gtri_den TO den(j)

ENDDO
USE IN pc

USE pc2
*GO BOTTOM
GATHER FROM ht(j) fields htns

FOR a = 1 TO j
GATHER FROM tu(a) fields tu
GATHER FROM den(a) fields den
ENDFOR

USE IN pc2
*-----------------------------------------------

SKIP
ENDFOR

use pc2
Browse

*-----------------------------------------------------------
*--- END !
*-----------------------------------------------------------
use
return

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100