Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Field values from a variable
Message
De
15/09/1998 13:02:26
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00136777
Message ID:
00136826
Vues:
32
>I have a xtab query myself. I'm trying to limit the number of fields in a report to 16 the 1st field always. and loop back every 15 of the rest. Also I would like to break the loops (a do while and a for loop), when there is no more data. Here's what I have so far:
>
>SELECT xtab
>GO TOP
>lnFieldTot = 2
>DO WHILE !EOF()
>FOR lnFCnt = 1 TO 15
>SELECT xtab
>lcFName = FIELD(lnFieldTot)
>lcFCnt = STR(lnFCnt)
>IF lnFCnt < 10
>lcATAFName = "ATA_Report.project"+RIGHT(lcFCnt,1)
>ELSE
>lcATAFName = "ATA_Report.project"+RIGHT(lcFCnt,2)
>ENDIF
>IF lnFCnt = 1
>SELECT ATA_Report
>GO BOTTOM
>APPEND BLANK
>REPLACE ATA_Report.ata WITH xtab.exp_1
>ENDIF
>IF !EMPTY(lcFName)
>lnATAFValue = EVAL('xtab.'+lcFName)
>lcATAFValue = STR(lnATAFValue)
>SELECT ATA_Report
>GO BOTTOM
>REPLACE &lcATAFName WITH TRIM(lcATAFValue)&& WILL NOT DO REPLACE
>ENDIF
>lnFieldTot = lnFieldTot + 1
>IF lnFCnt = 15
>lnFCnt = 0
>ENDIF
>IF lnFieldTot > FCOUNT()
>llEnd = .T.
>EXIT
>ENDIF
>ENDFOR
>SELECT xtab
>SKIP
>IF EOF()
>IF!llEnd
>GO TOP
>ELSE
>EXIT
>ENDIF
>ENDIF
>ENDDO
>
>TIA
Perry,
I'm not sure I understood correctly but could this be what you want :
select xtab
lnNeededCopies = ceiling((fcount()-1)/15)
for ix = 1 to lnNeededCopies  && Create n copies
	lcFields = field(1)
	for kx=(ix-1)*15+1+iif(ix=1,1,0) to min(ix*15,fcount())
	    lcFields = lcFields + "," + field(kx)
	endfor
	select &lcFields from xtab ;
	    into table ("xtab"+padl(ix,3,"0"))
	use in ("xtab"+padl(ix,3,"0"))
	select xtab
endfor
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform