Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Second to last
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01575940
Message ID:
01575956
Vues:
39
Hi Karen,

There is a small issue with the code, you should change the IF ALEN(lafielist, 1 )>=1 to > 1, otherwise it might error out if it only finds one file, as you are using the second item of the array which would not exist.

Hugo

>That works very nicely - thanks Dorris and Borislav
>Got a little better understanding of how the array works now - thanks for that.
>k
>
>.
>>
>>...
>>ndate = mdy(lafielist[1,3])
>>IF ALEN(lafielist, 1 ) >= 1
>>  SecondFileName = lafieldlist[2,1]
>>  Secondndate = mdy(lafielist[2,3])
>>  WAIT WINDOW Secondndate
>>ENDIF
>>..
>>
>>
>>
>>>thanks borislav
>>>I understand you are giving me the second to last date. how would I get the name of the second to last FILE linked with that date?
>>>
>>>k
>>>
>>>>>this is a followup to a solution I received from Sergey and Naomi (with thanks). It gives the title and date of the last changed database in a directory.
>>>>>
>>>>>I don't know if this is possible but could I select the one BEFORE the last database -
>>>>>The database that always comes up is called tasks.dbf and is actually always s changed. I would like the code to read
>>>>>if the last file is tasks.dbf then show me the one before that and it's date of change.
>>>>>
>>>>>I can make it to the if clause - and even that is probably not the most effective route.
>>>>>
>>>>>
>>>>>if lafielist='tasks.dbf'
>>>>>
>>>>>
>>>>>
>>>>>ltZeroTime = CTOT("00:00:00")
>>>>>= ADIR(laFieList, 'c:\db\prg\menu\*.dbf')
>>>>>FOR i= 1 TO ALEN(laFieList,1)
>>>>>laFieList[i,5] = DTOT(laFieList[i,3]) + (CTOT(laFieList[i,4]) - ltZeroTime)
>>>>>ENDFOR
>>>>>= ASORT(laFieList, 5,0,5)
>>>>>ndate = mdy(lafielist(1,3))
>>>>>ndm = "Last database file change: "+ndate+" "+lafielist
>>>>>
>>>>>
>>>>>tnx
>>>>>k
>>>>
>>>>
>>>>
>>>>...
>>>>ndate = mdy(lafielist[1,3])
>>>>IF ALEN(lafielist, 1 ) > 1
>>>>  Secondndate = mdy(lafielist[2,3])
>>>>  WAIT WINDOW Secondndate
>>>>ENDIF
>>>>..
>>>>
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?

"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare

"To die for a religion is easier than to live it absolutely"
Jorge L. Borges
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform