Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

No Spaces

Status
Not open for further replies.

reinaldo

Programmer
Mar 29, 2001
31
US
I have a table that I have to export as a text file. One of the fields in the table is the account field. Some of the records display as 22 256 7894. The problem is that when I export the table the account value has to show as 222567894,no spaces. I can export the table just fine, but is there a code that I can put in to export the values without spaces?

Thanks All
 
I would do a full query of the original table, then convert the resulting answer table before exporting it. Use code similar to the following. It assumes account numbers are all the same pattern and could stand some error checking for blanks.

Code:
var
 tc          tCursor
 ar Array[]  String
 acNum       String
endvar
;
;run this after the query
;
tc.open(":priv:answer.db")
;
scan  tc:
;
  acNum = tc."AccountNumber" ; your field
  acNum.breakApart(ar)
  acNum = ar[1]+ar[2]+ar[3]
  tc."AccountNumber" = acNum
;
endscan

After running this just export Answer.db. Only the AccountNumber field will be changed.

If the account number 'structure' varies from what you presented, it would require a few more lines to anticipate and deal with variances.



Mac :)

"There are only 10 kinds of people in this world... those who understand binary and those who don't"

langley_mckelvy@cd4.co.harris.tx.us
 
Tried a different variation but your posting really helped.

Thank you
 
Reinaldo,

I'm curious, what type of field is tha accont field? If it's a alpha field the field should have exported the spaces.

Perrin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top